yypsybs
2023-10-10 550ebcf02217f8a0c6fe9001fcfa8e42e9cd6b83
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Quintiq file version 2.0
#parent: CustomDrawRC/CustomDrawDataLayerRC
Response OnDrawObject (
  Routing object
) id:Response_CustomDrawRC_CustomDrawDataLayerRC_OnDrawObject
{
  #keys: '[139394.0.1275597002]'
  CanBindMultiple: false
  DefinitionID: 'Responsedef_WebCustomDrawDataLayer_OnDrawObject'
  Precondition:
  [*
    /* Comment precon out because we won't be drawing grid for web
    return guard( MacroPlan.RoutingConfiguratorView().IsGridVisible(), false )
           and guard( MacroPlan.RoutingConfiguratorView().GridPointDistance() > 0, false ); //prevent infinite loop
    */
  *]
  QuillAction
  {
    Body:
    [*
      // Draw background image
      rcv := MacroPlan.RoutingConfiguratorView();
      
      
      /* Comment this part out because we don't want grid in the background
      surface.Pen().Color( Colors.Grid() );
      
      width := rcv.GridWidth();
      height := rcv.GridHeight();
      grid := rcv.GridPointDistance();
      
      for ( x := 0; x < width; x := x + grid )
      {
        surface.Line( x, 0, x, height );
      }
      
      for ( y := 0; y < height; y := y + grid )
      {
        surface.Line( 0, y, width, y );
      }
      */
      
      //draw operation drop here!
      if( not object.HasStep() )
      {
        surface.Font().Size( rcv.FontSize() );
        surface.Font().Name(  rcv.FontName() );
        surface.TextColor( ColorScheme.RoutingConfigurator_DropHereHelp() );
        
        surface.Pen().Style( PenSpecification::StyleDashed() );
        surface.Pen().Color( ColorScheme.RoutingConfigurator_DropHereHelp() );  
        surface.Pen().Width( rcv.EdgeThickness() )
          
        // xy positions of the step
        stepX := rcv.OffsetX()
               + rcv.PISPWidth() + rcv.GridPointDistance() * 2;
      
        stepY := rcv.OffsetY();
      
        stepW := maxvalue( rcv.OperationWidth(), rcv.RoutingStepMinimumWidth() );
      
        value := ( 2 * rcv.OperationInputOutputHeight() )
                 + rcv.OperationHeight()
                 + 2 * rcv.OperationOffsetY();
      
        stepH := maxvalue( value, rcv.RoutingStepMinimumHeight() );
      
        rect := Shape::Rect( stepX , stepY, stepW, stepH );
        surface.Draw( rect );
        
        textformat := TextFormat::Construct( TextFormat::AlignCentered(), TextFormat::WrapWords() );
        surface.TextZoom( stepX , stepY, stepW, stepH, Translations::MP_Routing_DropHereUnit(), textformat );
      }
    *]
    GroupServerCalls: false
  }
}