Skip to content

Commit be71ab5

Browse files
committed
Usage of TActions modified
1 parent 573b4ef commit be71ab5

File tree

5 files changed

+120
-119
lines changed

5 files changed

+120
-119
lines changed

RibbonTools/Commands/ImageListFrame.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,34 +79,34 @@ private void InitActions(IContainer components)
7979
_actionAddImage.Hint = "Adds a new image";
8080
_actionAddImage.ImageIndex = 0;
8181
_actionAddImage.Text = "Add";
82-
_actionAddImage.SetComponent(toolButtonAddImage, true);
83-
_actionAddImage.SetComponent(popupAdd, true);
82+
_actionList.SetAction(toolButtonAddImage, _actionAddImage);
83+
_actionList.SetAction(popupAdd, _actionAddImage);
8484
//_actionAddCommand.ShowTextOnToolBar = false;
8585

8686
_actionRemoveImage.Execute += ActionRemoveImageExecute;
8787
_actionRemoveImage.Enabled = false;
8888
_actionRemoveImage.Hint = "Remove the selected image";
8989
_actionRemoveImage.ImageIndex = 1;
9090
_actionRemoveImage.Text = "Remove";
91-
_actionRemoveImage.SetComponent(toolButtonRemoveImage, true);
91+
_actionList.SetAction(toolButtonRemoveImage, _actionRemoveImage);
9292

9393
_actionRemoveAllImages.Execute += ActionRemoveAllImagesExecute;
9494
//_actionRemoveAllImages.ImageIndex = 1;
9595
_actionRemoveAllImages.Text = "Remove All";
96-
_actionRemoveAllImages.SetComponent(toolButtonRemoveAllImages, true);
96+
_actionList.SetAction(toolButtonRemoveAllImages, _actionRemoveAllImages);
9797

9898
_actionEditImage.Execute += ActionEditImageExecute;
9999
_actionEditImage.Enabled = false;
100100
_actionEditImage.Hint = "Edit the selected image";
101101
_actionEditImage.ImageIndex = 2;
102102
_actionEditImage.Text = "Edit";
103-
_actionEditImage.SetComponent(toolButtonEditImage, true);
103+
_actionList.SetAction(toolButtonEditImage, _actionEditImage);
104104

105105
_actionAddRange.Execute += ActionAddRangeExecute;
106106
_actionAddRange.Hint = "Add a range of images with different resolutions";
107107
//_actionAddRange.ImageIndex = 2;
108108
_actionAddRange.Text = "Add Range";
109-
_actionAddRange.SetComponent(popupAddRange, true);
109+
_actionList.SetAction(popupAddRange, _actionAddRange);
110110

111111
_actionList.ImageList = _imageListToolbars;
112112
}

RibbonTools/CommandsFrame.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ private void InitActions()
102102
_actionAddCommand.ImageIndex = 0;
103103
_actionAddCommand.ShortcutKeys = Keys.Shift | Keys.Control | Keys.Insert;
104104
_actionAddCommand.Text = "Add";
105-
_actionAddCommand.SetComponent(toolButtonAddCommand, true);
106-
_actionAddCommand.SetComponent(menuAddCommand, true);
105+
_actionList.SetAction(toolButtonAddCommand, _actionAddCommand);
106+
_actionList.SetAction(menuAddCommand, _actionAddCommand);
107107
//_actionAddCommand.ShowTextOnToolBar = false;
108108

109109
_actionRemoveCommand.Execute += ActionRemoveCommandExecute;
@@ -112,34 +112,34 @@ private void InitActions()
112112
_actionRemoveCommand.ImageIndex = 1;
113113
_actionRemoveCommand.ShortcutKeys = Keys.Control | Keys.Delete;
114114
_actionRemoveCommand.Text = "Remove";
115-
_actionRemoveCommand.SetComponent(toolButtonRemoveCommand, true);
116-
_actionRemoveCommand.SetComponent(menuRemoveCommand, true);
115+
_actionList.SetAction(toolButtonRemoveCommand, _actionRemoveCommand);
116+
_actionList.SetAction(menuRemoveCommand, _actionRemoveCommand);
117117

118118
_actionMoveUp.Execute += ActionMoveUpExecute;
119119
_actionMoveUp.Update += ActionUpdateUp;
120120
_actionMoveUp.Hint = "Moves the selected command up in the list";
121121
_actionMoveUp.ImageIndex = 2;
122122
_actionMoveUp.ShortcutKeys = Keys.Control | Keys.Up;
123123
_actionMoveUp.Text = "Up";
124-
_actionMoveUp.SetComponent(toolButtonMoveUp, true);
125-
_actionMoveUp.SetComponent(menuMoveUp, true);
124+
_actionList.SetAction(toolButtonMoveUp, _actionMoveUp);
125+
_actionList.SetAction(menuMoveUp, _actionMoveUp);
126126

127127
_actionMoveDown.Execute += ActionMoveDownExecute;
128128
_actionMoveDown.Update += ActionUpdateDown;
129129
_actionMoveDown.Hint = "Moves the selected command down in the list";
130130
_actionMoveDown.ImageIndex = 3;
131131
_actionMoveDown.ShortcutKeys = Keys.Control | Keys.Down;
132132
_actionMoveDown.Text = "Down";
133-
_actionMoveDown.SetComponent(toolButtonMoveDown, true);
134-
_actionMoveDown.SetComponent(menuMoveDown, true);
133+
_actionList.SetAction(toolButtonMoveDown, _actionMoveDown);
134+
_actionList.SetAction(menuMoveDown, _actionMoveDown);
135135

136136
_actionSearchCommand.Execute += ActionSearchCommandExecute;
137137
_actionSearchCommand.Update += ActionUpdate;
138138
_actionSearchCommand.Hint = string.Empty;
139139
_actionSearchCommand.ImageIndex = 4;
140140
_actionSearchCommand.ShortcutKeys = Keys.Control | Keys.F;
141141
_actionSearchCommand.Text = "Search";
142-
_actionSearchCommand.SetComponent(toolButtonSearchCommand, true);
142+
_actionList.SetAction(toolButtonSearchCommand, _actionSearchCommand);
143143

144144
_actionList.ImageList = _imageListToolbars;
145145
}

RibbonTools/Dialogs/NewFileForm.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ private void EditDirectoryRightButtonClick(object sender, EventArgs e)
9292
VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog();
9393
#endif
9494
dialog.Description = RS_SELECT_DIR_CAPTION;
95+
dialog.UseDescriptionForTitle = true;
9596
//dialog.RootFolder = Environment.SpecialFolder.MyDocuments;
9697
if (!string.IsNullOrEmpty(directory) && Directory.Exists(directory))
9798
dialog.InitialDirectory = directory;

RibbonTools/MainForm.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -175,24 +175,24 @@ private void InitActions()
175175
_actionPreview.ImageIndex = 3;
176176
_actionPreview.Text = "Preview";
177177
_actionPreview.ShortcutKeys = Keys.F9;
178-
_actionPreview.SetComponent(toolButtonPreview, true);
179-
_actionPreview.SetComponent(menuPreview, true);
178+
_actionList.SetAction(toolButtonPreview, _actionPreview);
179+
_actionList.SetAction(menuPreview, _actionPreview);
180180

181181
_actionOpen.Execute += ActionOpenExecute;
182182
_actionOpen.Hint = "Open an existing Ribbon document (Ctrl+O)";
183183
_actionOpen.ImageIndex = 1;
184184
_actionOpen.Text = "Open";
185185
_actionOpen.ShortcutKeys = (Keys)(Keys.Control | Keys.O);
186-
_actionOpen.SetComponent(toolButtonOpen, true);
187-
_actionOpen.SetComponent(menuOpen, true);
186+
_actionList.SetAction(toolButtonOpen, _actionOpen);
187+
_actionList.SetAction(menuOpen, _actionOpen);
188188
//_actionAddCommand.ShowTextOnToolBar = false;
189189

190190
_actionNew.Execute += ActionNewExecute;
191191
_actionNew.Hint = "Create a new Ribbon document (Ctrl+N)";
192192
_actionNew.ImageIndex = 0;
193193
_actionNew.Text = "New";
194194
_actionNew.ShortcutKeys = (Keys)(Keys.Control | Keys.N);
195-
_actionNew.SetComponent(menuNew, true);
195+
_actionList.SetAction(menuNew, _actionNew);
196196

197197
//_actionConvertImage.Visible = false;
198198
//_nN9.Visible = false;
@@ -201,85 +201,85 @@ private void InitActions()
201201
//_actionConvertImage.ImageIndex = 0;
202202
_actionConvertImage.Text = "Convert Images";
203203
//_actionConvertImage.ShortcutKeys = (Keys)(Keys.Control | Keys.N);
204-
_actionConvertImage.SetComponent(menuImage, true);
204+
_actionList.SetAction(menuImage, _actionConvertImage);
205205

206206
_actionGenerateCommandIDs.Execute += ActionGenerateCommandIDsExecute;
207207
_actionGenerateCommandIDs.Hint = "Generates and sets IDs for all commands in this markup.";
208208
_actionGenerateCommandIDs.Text = "Auto generate IDs for all commands";
209-
_actionGenerateCommandIDs.SetComponent(autoGenerateIdsForAllCommands, true);
209+
_actionList.SetAction(autoGenerateIdsForAllCommands, _actionGenerateCommandIDs);
210210

211211
_actionSaveAs.Execute += ActionSaveAsExecute;
212212
_actionSaveAs.Enabled = false; //@ added
213213
_actionSaveAs.Hint = "Saves the Ribbon document under a new name (Shift+Ctrl+S)";
214214
_actionSaveAs.Text = "Save As";
215215
_actionSaveAs.ShortcutKeys = (Keys)(Keys.Shift | Keys.Control | Keys.S);
216-
_actionSaveAs.SetComponent(menuSaveAs, true);
216+
_actionList.SetAction(menuSaveAs, _actionSaveAs);
217217

218218
_actionSave.Execute += ActionSaveExecute;
219219
_actionSave.Enabled = false; //@ added
220220
_actionSave.Hint = "Saves the Ribbon document (Ctrl+S)";
221221
_actionSave.ImageIndex = 2;
222222
_actionSave.Text = "Save";
223223
_actionSave.ShortcutKeys = (Keys)(Keys.Control | Keys.S);
224-
_actionSave.SetComponent(toolButtonSave, true);
225-
_actionSave.SetComponent(menuSave, true);
224+
_actionList.SetAction(toolButtonSave, _actionSave);
225+
_actionList.SetAction(menuSave, _actionSave);
226226

227227
_actionSettings.Execute += ActionSettingsExecute;
228228
_actionSettings.ImageIndex = 4;
229229
_actionSettings.Text = "Settings";
230-
_actionSettings.SetComponent(menuSettings, true);
230+
_actionList.SetAction(menuSettings, _actionSettings);
231231

232232
_actionExit.Execute += ActionExitExecute;
233233
_actionExit.Hint = "Exits the " + RS_RIBBON_TOOLS;
234234
_actionExit.Text = "Exit";
235-
_actionExit.SetComponent(menuExit, true);
235+
_actionList.SetAction(menuExit, _actionExit);
236236

237237
//_actionNewBlank.Hint = "Create a new blank Ribbon Document";
238238
//_actionNewBlank.Text = "Empty Ribbon Document";
239239
////_actionNewBlank.Shortcut = (Shortcut)16462;
240-
//_actionNewBlank.SetComponent(menuNew, true);
240+
//_actionList.SetAction(menuNew, _actionNewBlank);
241241

242242
_actionBuild.Execute += ActionBuildExecute;
243243
_actionBuild.Enabled = false; //@ added
244244
_actionBuild.Hint = "Build the ribbon (Ctrl+F9)";
245245
_actionBuild.ImageIndex = 5;
246246
_actionBuild.Text = "Build";
247247
_actionBuild.ShortcutKeys = (Keys)(Keys.Control | Keys.F9);
248-
_actionBuild.SetComponent(toolButtonBuild, true);
249-
_actionBuild.SetComponent(menuBuild, true);
248+
_actionList.SetAction(toolButtonBuild, _actionBuild);
249+
_actionList.SetAction(menuBuild, _actionBuild);
250250

251251
_actionTutorial.Execute += ActionTutorialExecute;
252252
_actionTutorial.ImageIndex = 7;
253253
_actionTutorial.Text = "Tutorial";
254-
_actionTutorial.SetComponent(menuTutorial, true);
254+
_actionList.SetAction(menuTutorial, _actionTutorial);
255255

256256
_actionWebSite.Execute += ActionWebSiteExecute;
257257
_actionWebSite.ImageIndex = 7;
258258
_actionWebSite.Text = "Ribbon Framework for Delphi website";
259-
_actionWebSite.SetComponent(menuWebSite, true);
259+
_actionList.SetAction(menuWebSite, _actionWebSite);
260260
_actionWebSite.Visible = false;
261261

262262
_actionDotnetWebSite.Execute += ActionDotnetWebSiteExecute;
263263
_actionDotnetWebSite.Hint = "C#, VB Ribbon Framework";
264264
_actionDotnetWebSite.ImageIndex = 7;
265265
_actionDotnetWebSite.Text = "Website for .NET Windows Ribbon";
266-
_actionDotnetWebSite.SetComponent(menuDotnetWebSite, true);
266+
_actionList.SetAction(menuDotnetWebSite, _actionDotnetWebSite);
267267

268268
_actionMSDN.Execute += ActionMSDNExecute;
269269
_actionMSDN.ImageIndex = 6;
270270
_actionMSDN.Text = "MSDN Windows Ribbon";
271-
_actionMSDN.SetComponent(menuMSDN, true);
271+
_actionList.SetAction(menuMSDN, _actionMSDN);
272272

273-
_actionSetResourceName.Visible = Settings.Instance.AllowChangingResourceName; // false; //@ not supported in .NET Ribbon
273+
_actionSetResourceName.Visible = Settings.Instance.AllowChangingResourceName; // false; //@ not necessary in .NET Ribbon
274274
_actionSetResourceName.Execute += ActionSetResourceNameExecute;
275275
_actionSetResourceName.Hint =
276276
"Set a resource name for the markup. This is necessary " + Environment.NewLine +
277277
"if multiple markups are used in one application." + Environment.NewLine +
278278
"The default is APPLICATION" + Environment.NewLine +
279-
Environment.NewLine + "Changing of default is not supported in .NET Ribbon";
279+
Environment.NewLine + "Changing of default is not necessary in .NET Ribbon";
280280

281281
_actionSetResourceName.Text = "Set ribbon resource name";
282-
_actionSetResourceName.SetComponent(setresourcename, true);
282+
_actionList.SetAction(setresourcename, _actionSetResourceName);
283283

284284
_actionGenerateResourceIDs.Execute += ActionGenerateResourceIDsExecute;
285285
_actionGenerateResourceIDs.Hint =
@@ -289,7 +289,7 @@ private void InitActions()
289289
"so that there are no conflicting resource IDs)";
290290
_actionGenerateResourceIDs.Text = "Auto generate IDs for all resources";
291291
_actionGenerateResourceIDs.ShortcutKeys = (Keys)(Keys.Control | Keys.G);
292-
_actionGenerateResourceIDs.SetComponent(autoGenerateIdsForAllResources, true);
292+
_actionList.SetAction(autoGenerateIdsForAllResources, _actionGenerateResourceIDs);
293293

294294
_actionList.ImageList = _imageListMain;
295295
}

0 commit comments

Comments
 (0)