Changeset 113 for branches


Ignore:
Timestamp:
Aug 9, 2017, 10:14:31 PM (7 years ago)
Author:
chronos
Message:
  • Added: Allow to move up/down rule items.
  • Fixed: Store rule operator to XML file.
Location:
branches/generator
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/generator/Forms/UFormRule.lfm

    r112 r113  
    114114      Action = ARemove
    115115    end
     116    object ToolButton4: TToolButton
     117      Left = 70
     118      Top = 2
     119      Action = AMoveUp
     120    end
     121    object ToolButton5: TToolButton
     122      Left = 93
     123      Top = 2
     124      Action = AMoveDown
     125    end
    116126  end
    117127  object ActionList1: TActionList
     
    134144      OnExecute = ARemoveExecute
    135145    end
     146    object AMoveUp: TAction
     147      Caption = 'Move up'
     148      ImageIndex = 7
     149      OnExecute = AMoveUpExecute
     150    end
     151    object AMoveDown: TAction
     152      Caption = 'Move down'
     153      ImageIndex = 6
     154      OnExecute = AMoveDownExecute
     155    end
    136156  end
    137157  object PopupMenu1: TPopupMenu
    138158    Images = Core.ImageList1
    139159    left = 118
    140     top = 185
     160    top = 187
    141161    object MenuItem1: TMenuItem
    142162      Action = AAdd
     
    148168      Action = ARemove
    149169    end
     170    object MenuItem4: TMenuItem
     171      Action = AMoveUp
     172    end
     173    object MenuItem5: TMenuItem
     174      Action = AMoveDown
     175    end
    150176  end
    151177end
  • branches/generator/Forms/UFormRule.pas

    r112 r113  
    1515  TFormRule = class(TForm)
    1616    AAdd: TAction;
     17    AMoveUp: TAction;
     18    AMoveDown: TAction;
    1719    AModify: TAction;
    1820    ARemove: TAction;
     
    2830    MenuItem2: TMenuItem;
    2931    MenuItem3: TMenuItem;
     32    MenuItem4: TMenuItem;
     33    MenuItem5: TMenuItem;
    3034    PopupMenu1: TPopupMenu;
    3135    ToolBar1: TToolBar;
     
    3337    ToolButton2: TToolButton;
    3438    ToolButton3: TToolButton;
     39    ToolButton4: TToolButton;
     40    ToolButton5: TToolButton;
    3541    procedure AAddExecute(Sender: TObject);
    3642    procedure AModifyExecute(Sender: TObject);
     43    procedure AMoveDownExecute(Sender: TObject);
     44    procedure AMoveUpExecute(Sender: TObject);
    3745    procedure ARemoveExecute(Sender: TObject);
    3846    procedure FormShow(Sender: TObject);
     
    123131end;
    124132
     133procedure TFormRule.AMoveDownExecute(Sender: TObject);
     134begin
     135  Rule.Items.Move(ListView.Selected.Index, ListView.Selected.Index + 1);
     136//  ShowMessage(IntToStr(ListView.ItemIndex));
     137  ListView.ItemIndex := ListView.Selected.Index + 1;
     138//  ShowMessage(IntToStr(ListView.ItemIndex));
     139  ReloadList;
     140end;
     141
     142procedure TFormRule.AMoveUpExecute(Sender: TObject);
     143begin
     144  Rule.Items.Move(ListView.Selected.Index, ListView.Selected.Index - 1);
     145  ListView.ItemIndex := ListView.Selected.Index - 1;
     146  ReloadList;
     147end;
     148
    125149procedure TFormRule.ARemoveExecute(Sender: TObject);
    126150var
     
    137161  AModify.Enabled := Assigned(ListView.Selected);
    138162  ARemove.Enabled := Assigned(ListView.Selected);
     163  AMoveUp.Enabled := Assigned(ListView.Selected) and (ListView.Selected.Index > 0);
     164  AMoveDown.Enabled := Assigned(ListView.Selected) and (ListView.Selected.Index < (ListView.Items.Count - 1));
    139165end;
    140166
  • branches/generator/UCore.lfm

    r112 r113  
    1111    top = 243
    1212    Bitmap = {
    13       4C69060000001000000010000000000000000000000000000000000000000000
     13      4C69080000001000000010000000000000000000000000000000000000000000
    1414      000070A970FF006400FF006200FF70A670FF0000000000000000000000000000
    1515      0000000000000000000000000000000000000000000000000000000000000000
     
    203203      00FF000000FF000000FF00000000000000000000000000000000000000000000
    204204      0000000000000000000000000000000000000000000000000000000000000000
     205      0000000000000000000000000000000000000000000000000000000000000000
     206      0000000000000000000000000000000000000000000000000000000000000000
     207      0000000000000000000000000000000000000000000000000000000000000000
     208      00FF000000FF000000FF000000FF000000FF000000FF000000FF000000000000
     209      0000000000000000000000000000000000000000000000000000000000000000
     210      00FFFF2619FFFF2E1EFFFF3522FFFF3C28FFFF442CFF000000FF000000000000
     211      0000000000000000000000000000000000000000000000000000000000000000
     212      00FFFF3623FFFF3C28FFFF442CFFFF4C32FFFF5337FF000000FF000000000000
     213      0000000000000000000000000000000000000000000000000000000000000000
     214      00FFFF442CFFFF4C32FFFF5437FFFF5C3BFFFF6341FF000000FF000000000000
     215      0000000000000000000000000000000000000000000000000000000000000000
     216      00FFFF5437FFFF5D3CFFFF6441FFFF6B46FFFF724AFF000000FF000000000000
     217      0000000000000000000000000000000000000000000000000000000000000000
     218      00FFFF6441FFFF6C46FFFF744BFFFF7A4FFFFF8255FF000000FF000000000000
     219      0000000000000000000000000000000000000000000000000000000000000000
     220      00FFFF744CFFFF7C51FFFF8255FFFF8A5AFFFF915FFF000000FF000000000000
     221      0000000000000000000000000000000000FF000000FF000000FF000000FF0000
     222      00FFFF8456FFFF8A5AFFFF9360FFFF9A65FFFFA169FF000000FF000000FF0000
     223      00FF000000FF000000FF0000000000000000000000FFFF7C51FFFF8456FFFF8C
     224      5BFFFF9360FFFF9A65FFFFA269FFFFAA6EFFFFB073FFFFB878FFFFBF7DFFFFC6
     225      81FF000000FF00000000000000000000000000000000000000FFFF9461FFFF9A
     226      65FFFFA269FFFFAA6EFFFFB174FFFFB878FFFFC17DFFFFC882FFFFCF87FF0000
     227      00FF000000000000000000000000000000000000000000000000000000FFFFAA
     228      6EFFFFB374FFFFBA79FFFFC17DFFFFC882FFFFD088FFFFD78CFF000000FF0000
     229      0000000000000000000000000000000000000000000000000000000000000000
     230      00FFFFC27EFFFFC882FFFFD088FFFFD88CFFFFE092FF000000FF000000000000
     231      0000000000000000000000000000000000000000000000000000000000000000
     232      0000000000FFFFD88CFFFFE092FFFFE797FF000000FF00000000000000000000
     233      0000000000000000000000000000000000000000000000000000000000000000
     234      000000000000000000FFFFF09CFF000000FF0000000000000000000000000000
     235      0000000000000000000000000000000000000000000000000000000000000000
     236      00000000000000000000000000FF000000000000000000000000000000000000
     237      0000000000000000000000000000000000000000000000000000000000000000
     238      0000000000000000000000000000000000FF0000000000000000000000000000
     239      0000000000000000000000000000000000000000000000000000000000000000
     240      00000000000000000000000000FFFFF09CFF000000FF00000000000000000000
     241      0000000000000000000000000000000000000000000000000000000000000000
     242      000000000000000000FFFFE797FFFFE092FFFFD88CFF000000FF000000000000
     243      0000000000000000000000000000000000000000000000000000000000000000
     244      0000000000FFFFE092FFFFD88CFFFFD088FFFFC882FFFFC27EFF000000FF0000
     245      0000000000000000000000000000000000000000000000000000000000000000
     246      00FFFFD78CFFFFD088FFFFC882FFFFC17DFFFFBA79FFFFB374FFFFAA6EFF0000
     247      00FF000000000000000000000000000000000000000000000000000000FFFFCF
     248      87FFFFC882FFFFC17DFFFFB878FFFFB174FFFFAA6EFFFFA269FFFF9A65FFFF94
     249      61FF000000FF00000000000000000000000000000000000000FFFFC681FFFFBF
     250      7DFFFFB878FFFFB073FFFFAA6EFFFFA269FFFF9A65FFFF9360FFFF8C5BFFFF84
     251      56FFFF7C51FF000000FF0000000000000000000000FF000000FF000000FF0000
     252      00FF000000FFFFA169FFFF9A65FFFF9360FFFF8A5AFFFF8456FF000000FF0000
     253      00FF000000FF000000FF000000FF000000000000000000000000000000000000
     254      0000000000FFFF915FFFFF8A5AFFFF8255FFFF7C51FFFF744CFF000000FF0000
     255      0000000000000000000000000000000000000000000000000000000000000000
     256      0000000000FFFF8255FFFF7A4FFFFF744BFFFF6C46FFFF6441FF000000FF0000
     257      0000000000000000000000000000000000000000000000000000000000000000
     258      0000000000FFFF724AFFFF6B46FFFF6441FFFF5D3CFFFF5437FF000000FF0000
     259      0000000000000000000000000000000000000000000000000000000000000000
     260      0000000000FFFF6341FFFF5C3BFFFF5437FFFF4C32FFFF442CFF000000FF0000
     261      0000000000000000000000000000000000000000000000000000000000000000
     262      0000000000FFFF5337FFFF4C32FFFF442CFFFF3C28FFFF3623FF000000FF0000
     263      0000000000000000000000000000000000000000000000000000000000000000
     264      0000000000FFFF442CFFFF3C28FFFF3522FFFF2E1EFFFF2619FF000000FF0000
     265      0000000000000000000000000000000000000000000000000000000000000000
     266      0000000000FF000000FF000000FF000000FF000000FF000000FF000000FF0000
     267      0000000000000000000000000000000000000000000000000000000000000000
     268      0000000000000000000000000000000000000000000000000000000000000000
    205269      0000000000000000000000000000
    206270    }
  • branches/generator/URules.pas

    r112 r113  
    229229begin
    230230  WriteString(Node, 'Name', Name);
     231  WriteInteger(Node, 'Type', Integer(RuleType));
    231232
    232233  RuleItemsNode := Node.OwnerDocument.CreateElement('RuleItems');
     
    266267begin
    267268  Name := ReadString(Node, 'Name', '');
     269  RuleType := TRuleType(ReadInteger(Node, 'Type', Integer(rtAnd)));
    268270
    269271  ItemsNode := Node.FindNode('RuleItems');
  • branches/generator/pascal.grm

    r111 r113  
    44    <Rule>
    55      <Name>BeginEnd</Name>
     6      <Type>0</Type>
    67      <RuleItems>
    78        <RuleItem>
     
    1112        <RuleItem>
    1213          <Type>1</Type>
    13           <NonTerminal>Command</NonTerminal>
     14          <NonTerminal>Statement</NonTerminal>
    1415        </RuleItem>
    1516        <RuleItem>
     
    2122    <Rule>
    2223      <Name>IfThenElse</Name>
     24      <Type>0</Type>
    2325      <RuleItems>
    2426        <RuleItem>
     
    3638        <RuleItem>
    3739          <Type>1</Type>
    38           <NonTerminal>Command</NonTerminal>
     40          <NonTerminal>Statement</NonTerminal>
    3941        </RuleItem>
    4042        <RuleItem>
     
    4446        <RuleItem>
    4547          <Type>1</Type>
    46           <NonTerminal>Command</NonTerminal>
     48          <NonTerminal>Statement</NonTerminal>
    4749        </RuleItem>
    4850        <RuleItem>
     
    5456    <Rule>
    5557      <Name>WhileDo</Name>
     58      <Type>0</Type>
    5659      <RuleItems>
    5760        <RuleItem>
     
    6972        <RuleItem>
    7073          <Type>1</Type>
    71           <NonTerminal>Command</NonTerminal>
     74          <NonTerminal>Statement</NonTerminal>
    7275        </RuleItem>
    7376      </RuleItems>
     
    7578    <Rule>
    7679      <Name>RepeatUntil</Name>
     80      <Type>0</Type>
    7781      <RuleItems>
    7882        <RuleItem>
     
    8286        <RuleItem>
    8387          <Type>1</Type>
    84           <NonTerminal>Command</NonTerminal>
     88          <NonTerminal>Statement</NonTerminal>
    8589        </RuleItem>
    8690        <RuleItem>
     
    96100    <Rule>
    97101      <Name>ForToDo</Name>
     102      <Type>0</Type>
     103      <RuleItems>
     104        <RuleItem>
     105          <Type>0</Type>
     106          <Terminal>for</Terminal>
     107        </RuleItem>
     108        <RuleItem>
     109          <Type>1</Type>
     110          <NonTerminal>VariableRef</NonTerminal>
     111        </RuleItem>
     112        <RuleItem>
     113          <Type>0</Type>
     114          <Terminal>:=</Terminal>
     115        </RuleItem>
     116        <RuleItem>
     117          <Type>1</Type>
     118          <NonTerminal>Expression</NonTerminal>
     119        </RuleItem>
     120        <RuleItem>
     121          <Type>0</Type>
     122          <Terminal>to</Terminal>
     123        </RuleItem>
     124        <RuleItem>
     125          <Type>1</Type>
     126          <NonTerminal>Expression</NonTerminal>
     127        </RuleItem>
     128        <RuleItem>
     129          <Type>0</Type>
     130          <Terminal>do</Terminal>
     131        </RuleItem>
     132        <RuleItem>
     133          <Type>1</Type>
     134          <NonTerminal>Statement</NonTerminal>
     135        </RuleItem>
     136      </RuleItems>
     137    </Rule>
     138    <Rule>
     139      <Name>WithDo</Name>
     140      <Type>0</Type>
     141      <RuleItems>
     142        <RuleItem>
     143          <Type>0</Type>
     144          <Terminal>with</Terminal>
     145        </RuleItem>
     146        <RuleItem>
     147          <Type>1</Type>
     148          <NonTerminal>VariableRef</NonTerminal>
     149        </RuleItem>
     150        <RuleItem>
     151          <Type>0</Type>
     152          <Terminal>do</Terminal>
     153        </RuleItem>
     154        <RuleItem>
     155          <Type>1</Type>
     156          <NonTerminal>Statement</NonTerminal>
     157        </RuleItem>
     158      </RuleItems>
     159    </Rule>
     160    <Rule>
     161      <Name>CaseOf</Name>
     162      <Type>0</Type>
     163      <RuleItems>
     164        <RuleItem>
     165          <Type>0</Type>
     166          <Terminal>case</Terminal>
     167        </RuleItem>
     168        <RuleItem>
     169          <Type>1</Type>
     170          <NonTerminal>Expression</NonTerminal>
     171        </RuleItem>
     172        <RuleItem>
     173          <Type>0</Type>
     174          <Terminal>of</Terminal>
     175        </RuleItem>
     176        <RuleItem>
     177          <Type>0</Type>
     178          <Terminal>end</Terminal>
     179        </RuleItem>
     180      </RuleItems>
     181    </Rule>
     182    <Rule>
     183      <Name>Assignment</Name>
     184      <Type>0</Type>
     185      <RuleItems>
     186        <RuleItem>
     187          <Type>1</Type>
     188          <NonTerminal>VariableRef</NonTerminal>
     189        </RuleItem>
     190        <RuleItem>
     191          <Type>0</Type>
     192          <Terminal>:=</Terminal>
     193        </RuleItem>
     194        <RuleItem>
     195          <Type>1</Type>
     196          <NonTerminal>Expression</NonTerminal>
     197        </RuleItem>
     198      </RuleItems>
     199    </Rule>
     200    <Rule>
     201      <Name>Statement</Name>
     202      <Type>1</Type>
     203      <RuleItems>
     204        <RuleItem>
     205          <Type>1</Type>
     206          <NonTerminal>BeginEnd</NonTerminal>
     207        </RuleItem>
     208        <RuleItem>
     209          <Type>1</Type>
     210          <NonTerminal>IfThenElse</NonTerminal>
     211        </RuleItem>
     212        <RuleItem>
     213          <Type>1</Type>
     214          <NonTerminal>WhileDo</NonTerminal>
     215        </RuleItem>
     216        <RuleItem>
     217          <Type>1</Type>
     218          <NonTerminal>RepeatUntil</NonTerminal>
     219        </RuleItem>
     220        <RuleItem>
     221          <Type>1</Type>
     222          <NonTerminal>ForToDo</NonTerminal>
     223        </RuleItem>
     224        <RuleItem>
     225          <Type>1</Type>
     226          <NonTerminal>WithDo</NonTerminal>
     227        </RuleItem>
     228        <RuleItem>
     229          <Type>1</Type>
     230          <NonTerminal>CaseOf</NonTerminal>
     231        </RuleItem>
     232        <RuleItem>
     233          <Type>1</Type>
     234          <NonTerminal>Assignment</NonTerminal>
     235        </RuleItem>
     236      </RuleItems>
     237    </Rule>
     238    <Rule>
     239      <Name>Expression</Name>
     240      <Type>0</Type>
    98241      <RuleItems/>
    99242    </Rule>
    100243    <Rule>
    101       <Name>WithDo</Name>
     244      <Name>VariableRef</Name>
     245      <Type>0</Type>
    102246      <RuleItems/>
    103247    </Rule>
    104248    <Rule>
    105       <Name>CaseOf</Name>
     249      <Name>Program</Name>
     250      <Type>0</Type>
     251      <RuleItems>
     252        <RuleItem>
     253          <Type>1</Type>
     254          <NonTerminal>BeginEnd</NonTerminal>
     255        </RuleItem>
     256        <RuleItem>
     257          <Type>0</Type>
     258          <Terminal>.</Terminal>
     259        </RuleItem>
     260      </RuleItems>
     261    </Rule>
     262    <Rule>
     263      <Name>Uses</Name>
     264      <Type>0</Type>
     265      <RuleItems>
     266        <RuleItem>
     267          <Type>0</Type>
     268          <Terminal>uses</Terminal>
     269        </RuleItem>
     270        <RuleItem>
     271          <Type>1</Type>
     272          <NonTerminal>UnitName</NonTerminal>
     273        </RuleItem>
     274        <RuleItem>
     275          <Type>0</Type>
     276          <Terminal>,</Terminal>
     277        </RuleItem>
     278      </RuleItems>
     279    </Rule>
     280    <Rule>
     281      <Name>UnitName</Name>
     282      <Type>0</Type>
    106283      <RuleItems/>
    107284    </Rule>
    108285    <Rule>
    109       <Name>Assignment</Name>
    110       <RuleItems>
    111         <RuleItem>
    112           <Type>1</Type>
    113           <NonTerminal>Variable</NonTerminal>
    114         </RuleItem>
    115         <RuleItem>
    116           <Type>0</Type>
    117           <Terminal>:=</Terminal>
    118         </RuleItem>
    119         <RuleItem>
    120           <Type>1</Type>
    121           <NonTerminal>Expression</NonTerminal>
    122         </RuleItem>
    123       </RuleItems>
    124     </Rule>
    125     <Rule>
    126       <Name>Command</Name>
     286      <Name>Function</Name>
     287      <Type>0</Type>
     288      <RuleItems>
     289        <RuleItem>
     290          <Type>0</Type>
     291          <Terminal>function</Terminal>
     292        </RuleItem>
     293        <RuleItem>
     294          <Type>1</Type>
     295          <NonTerminal>Identifier</NonTerminal>
     296        </RuleItem>
     297        <RuleItem>
     298          <Type>0</Type>
     299          <Terminal>;</Terminal>
     300        </RuleItem>
     301        <RuleItem>
     302          <Type>1</Type>
     303          <NonTerminal>BeginEnd</NonTerminal>
     304        </RuleItem>
     305        <RuleItem>
     306          <Type>0</Type>
     307          <Terminal>;</Terminal>
     308        </RuleItem>
     309      </RuleItems>
     310    </Rule>
     311    <Rule>
     312      <Name>Identifier</Name>
     313      <Type>0</Type>
    127314      <RuleItems/>
    128315    </Rule>
    129316    <Rule>
    130       <Name>Expression</Name>
    131       <RuleItems/>
    132     </Rule>
    133     <Rule>
    134       <Name>Variable</Name>
    135       <RuleItems/>
     317      <Name>VarSection</Name>
     318      <Type>0</Type>
     319      <RuleItems>
     320        <RuleItem>
     321          <Type>0</Type>
     322          <Terminal>var</Terminal>
     323        </RuleItem>
     324      </RuleItems>
    136325    </Rule>
    137326  </Rules>
Note: See TracChangeset for help on using the changeset viewer.