Revision | 498 (tree) |
---|---|
Time | 2020-02-27 23:26:21 |
Author | ![]() |
KX.Notifiers possui erros e codificações temporárias
KRKLib atualizado com duas novas units KRK.ToolsAPI.Utilities.pas e KRK.Vcl.Menus.pas
Início da modificação em KRK.Rtl.Common.ComponentUtils.pas para tentar melhorar as rotinas de clonagem de menus
Comentários adicionados em KRK.ToolsApi.Components.EditServicesNotifier.pas
Lista de ignorância atualizada
@@ -5,7 +5,7 @@ | ||
5 | 5 | <FrameworkType>VCL</FrameworkType> |
6 | 6 | <MainSource>KRKExperts.dpr</MainSource> |
7 | 7 | <Base>True</Base> |
8 | - <Config Condition="'$(Config)'==''">Release</Config> | |
8 | + <Config Condition="'$(Config)'==''">Debug</Config> | |
9 | 9 | <Platform Condition="'$(Platform)'==''">Win32</Platform> |
10 | 10 | <TargetedPlatforms>1</TargetedPlatforms> |
11 | 11 | <AppType>Library</AppType> |
@@ -242,10 +242,6 @@ | ||
242 | 242 | <RemoteDir>classes</RemoteDir> |
243 | 243 | <Operation>1</Operation> |
244 | 244 | </Platform> |
245 | - <Platform Name="Android64"> | |
246 | - <RemoteDir>classes</RemoteDir> | |
247 | - <Operation>1</Operation> | |
248 | - </Platform> | |
249 | 245 | </DeployClass> |
250 | 246 | <DeployClass Name="AndroidFileProvider"> |
251 | 247 | <Platform Name="Android"> |
@@ -252,10 +248,6 @@ | ||
252 | 248 | <RemoteDir>res\xml</RemoteDir> |
253 | 249 | <Operation>1</Operation> |
254 | 250 | </Platform> |
255 | - <Platform Name="Android64"> | |
256 | - <RemoteDir>res\xml</RemoteDir> | |
257 | - <Operation>1</Operation> | |
258 | - </Platform> | |
259 | 251 | </DeployClass> |
260 | 252 | <DeployClass Name="AndroidGDBServer"> |
261 | 253 | <Platform Name="Android"> |
@@ -268,10 +260,6 @@ | ||
268 | 260 | <RemoteDir>library\lib\armeabi</RemoteDir> |
269 | 261 | <Operation>1</Operation> |
270 | 262 | </Platform> |
271 | - <Platform Name="Android64"> | |
272 | - <RemoteDir>library\lib\armeabi</RemoteDir> | |
273 | - <Operation>1</Operation> | |
274 | - </Platform> | |
275 | 263 | </DeployClass> |
276 | 264 | <DeployClass Name="AndroidLibnativeArmeabiv7aFile"> |
277 | 265 | <Platform Name="Android64"> |
@@ -284,10 +272,6 @@ | ||
284 | 272 | <RemoteDir>library\lib\mips</RemoteDir> |
285 | 273 | <Operation>1</Operation> |
286 | 274 | </Platform> |
287 | - <Platform Name="Android64"> | |
288 | - <RemoteDir>library\lib\mips</RemoteDir> | |
289 | - <Operation>1</Operation> | |
290 | - </Platform> | |
291 | 275 | </DeployClass> |
292 | 276 | <DeployClass Name="AndroidServiceOutput"> |
293 | 277 | <Platform Name="Android"> |
@@ -294,10 +278,6 @@ | ||
294 | 278 | <RemoteDir>library\lib\armeabi-v7a</RemoteDir> |
295 | 279 | <Operation>1</Operation> |
296 | 280 | </Platform> |
297 | - <Platform Name="Android64"> | |
298 | - <RemoteDir>library\lib\arm64-v8a</RemoteDir> | |
299 | - <Operation>1</Operation> | |
300 | - </Platform> | |
301 | 281 | </DeployClass> |
302 | 282 | <DeployClass Name="AndroidServiceOutput_Android32"> |
303 | 283 | <Platform Name="Android64"> |
@@ -310,10 +290,6 @@ | ||
310 | 290 | <RemoteDir>res\drawable</RemoteDir> |
311 | 291 | <Operation>1</Operation> |
312 | 292 | </Platform> |
313 | - <Platform Name="Android64"> | |
314 | - <RemoteDir>res\drawable</RemoteDir> | |
315 | - <Operation>1</Operation> | |
316 | - </Platform> | |
317 | 293 | </DeployClass> |
318 | 294 | <DeployClass Name="AndroidSplashStyles"> |
319 | 295 | <Platform Name="Android"> |
@@ -320,10 +296,6 @@ | ||
320 | 296 | <RemoteDir>res\values</RemoteDir> |
321 | 297 | <Operation>1</Operation> |
322 | 298 | </Platform> |
323 | - <Platform Name="Android64"> | |
324 | - <RemoteDir>res\values</RemoteDir> | |
325 | - <Operation>1</Operation> | |
326 | - </Platform> | |
327 | 299 | </DeployClass> |
328 | 300 | <DeployClass Name="AndroidSplashStylesV21"> |
329 | 301 | <Platform Name="Android"> |
@@ -330,10 +302,6 @@ | ||
330 | 302 | <RemoteDir>res\values-v21</RemoteDir> |
331 | 303 | <Operation>1</Operation> |
332 | 304 | </Platform> |
333 | - <Platform Name="Android64"> | |
334 | - <RemoteDir>res\values-v21</RemoteDir> | |
335 | - <Operation>1</Operation> | |
336 | - </Platform> | |
337 | 305 | </DeployClass> |
338 | 306 | <DeployClass Name="Android_Colors"> |
339 | 307 | <Platform Name="Android"> |
@@ -340,10 +308,6 @@ | ||
340 | 308 | <RemoteDir>res\values</RemoteDir> |
341 | 309 | <Operation>1</Operation> |
342 | 310 | </Platform> |
343 | - <Platform Name="Android64"> | |
344 | - <RemoteDir>res\values</RemoteDir> | |
345 | - <Operation>1</Operation> | |
346 | - </Platform> | |
347 | 311 | </DeployClass> |
348 | 312 | <DeployClass Name="Android_DefaultAppIcon"> |
349 | 313 | <Platform Name="Android"> |
@@ -350,10 +314,6 @@ | ||
350 | 314 | <RemoteDir>res\drawable</RemoteDir> |
351 | 315 | <Operation>1</Operation> |
352 | 316 | </Platform> |
353 | - <Platform Name="Android64"> | |
354 | - <RemoteDir>res\drawable</RemoteDir> | |
355 | - <Operation>1</Operation> | |
356 | - </Platform> | |
357 | 317 | </DeployClass> |
358 | 318 | <DeployClass Name="Android_LauncherIcon144"> |
359 | 319 | <Platform Name="Android"> |
@@ -360,10 +320,6 @@ | ||
360 | 320 | <RemoteDir>res\drawable-xxhdpi</RemoteDir> |
361 | 321 | <Operation>1</Operation> |
362 | 322 | </Platform> |
363 | - <Platform Name="Android64"> | |
364 | - <RemoteDir>res\drawable-xxhdpi</RemoteDir> | |
365 | - <Operation>1</Operation> | |
366 | - </Platform> | |
367 | 323 | </DeployClass> |
368 | 324 | <DeployClass Name="Android_LauncherIcon36"> |
369 | 325 | <Platform Name="Android"> |
@@ -370,10 +326,6 @@ | ||
370 | 326 | <RemoteDir>res\drawable-ldpi</RemoteDir> |
371 | 327 | <Operation>1</Operation> |
372 | 328 | </Platform> |
373 | - <Platform Name="Android64"> | |
374 | - <RemoteDir>res\drawable-ldpi</RemoteDir> | |
375 | - <Operation>1</Operation> | |
376 | - </Platform> | |
377 | 329 | </DeployClass> |
378 | 330 | <DeployClass Name="Android_LauncherIcon48"> |
379 | 331 | <Platform Name="Android"> |
@@ -380,10 +332,6 @@ | ||
380 | 332 | <RemoteDir>res\drawable-mdpi</RemoteDir> |
381 | 333 | <Operation>1</Operation> |
382 | 334 | </Platform> |
383 | - <Platform Name="Android64"> | |
384 | - <RemoteDir>res\drawable-mdpi</RemoteDir> | |
385 | - <Operation>1</Operation> | |
386 | - </Platform> | |
387 | 335 | </DeployClass> |
388 | 336 | <DeployClass Name="Android_LauncherIcon72"> |
389 | 337 | <Platform Name="Android"> |
@@ -390,10 +338,6 @@ | ||
390 | 338 | <RemoteDir>res\drawable-hdpi</RemoteDir> |
391 | 339 | <Operation>1</Operation> |
392 | 340 | </Platform> |
393 | - <Platform Name="Android64"> | |
394 | - <RemoteDir>res\drawable-hdpi</RemoteDir> | |
395 | - <Operation>1</Operation> | |
396 | - </Platform> | |
397 | 341 | </DeployClass> |
398 | 342 | <DeployClass Name="Android_LauncherIcon96"> |
399 | 343 | <Platform Name="Android"> |
@@ -400,10 +344,6 @@ | ||
400 | 344 | <RemoteDir>res\drawable-xhdpi</RemoteDir> |
401 | 345 | <Operation>1</Operation> |
402 | 346 | </Platform> |
403 | - <Platform Name="Android64"> | |
404 | - <RemoteDir>res\drawable-xhdpi</RemoteDir> | |
405 | - <Operation>1</Operation> | |
406 | - </Platform> | |
407 | 347 | </DeployClass> |
408 | 348 | <DeployClass Name="Android_NotificationIcon24"> |
409 | 349 | <Platform Name="Android"> |
@@ -410,10 +350,6 @@ | ||
410 | 350 | <RemoteDir>res\drawable-mdpi</RemoteDir> |
411 | 351 | <Operation>1</Operation> |
412 | 352 | </Platform> |
413 | - <Platform Name="Android64"> | |
414 | - <RemoteDir>res\drawable-mdpi</RemoteDir> | |
415 | - <Operation>1</Operation> | |
416 | - </Platform> | |
417 | 353 | </DeployClass> |
418 | 354 | <DeployClass Name="Android_NotificationIcon36"> |
419 | 355 | <Platform Name="Android"> |
@@ -420,10 +356,6 @@ | ||
420 | 356 | <RemoteDir>res\drawable-hdpi</RemoteDir> |
421 | 357 | <Operation>1</Operation> |
422 | 358 | </Platform> |
423 | - <Platform Name="Android64"> | |
424 | - <RemoteDir>res\drawable-hdpi</RemoteDir> | |
425 | - <Operation>1</Operation> | |
426 | - </Platform> | |
427 | 359 | </DeployClass> |
428 | 360 | <DeployClass Name="Android_NotificationIcon48"> |
429 | 361 | <Platform Name="Android"> |
@@ -430,10 +362,6 @@ | ||
430 | 362 | <RemoteDir>res\drawable-xhdpi</RemoteDir> |
431 | 363 | <Operation>1</Operation> |
432 | 364 | </Platform> |
433 | - <Platform Name="Android64"> | |
434 | - <RemoteDir>res\drawable-xhdpi</RemoteDir> | |
435 | - <Operation>1</Operation> | |
436 | - </Platform> | |
437 | 365 | </DeployClass> |
438 | 366 | <DeployClass Name="Android_NotificationIcon72"> |
439 | 367 | <Platform Name="Android"> |
@@ -440,10 +368,6 @@ | ||
440 | 368 | <RemoteDir>res\drawable-xxhdpi</RemoteDir> |
441 | 369 | <Operation>1</Operation> |
442 | 370 | </Platform> |
443 | - <Platform Name="Android64"> | |
444 | - <RemoteDir>res\drawable-xxhdpi</RemoteDir> | |
445 | - <Operation>1</Operation> | |
446 | - </Platform> | |
447 | 371 | </DeployClass> |
448 | 372 | <DeployClass Name="Android_NotificationIcon96"> |
449 | 373 | <Platform Name="Android"> |
@@ -450,10 +374,6 @@ | ||
450 | 374 | <RemoteDir>res\drawable-xxxhdpi</RemoteDir> |
451 | 375 | <Operation>1</Operation> |
452 | 376 | </Platform> |
453 | - <Platform Name="Android64"> | |
454 | - <RemoteDir>res\drawable-xxxhdpi</RemoteDir> | |
455 | - <Operation>1</Operation> | |
456 | - </Platform> | |
457 | 377 | </DeployClass> |
458 | 378 | <DeployClass Name="Android_SplashImage426"> |
459 | 379 | <Platform Name="Android"> |
@@ -460,10 +380,6 @@ | ||
460 | 380 | <RemoteDir>res\drawable-small</RemoteDir> |
461 | 381 | <Operation>1</Operation> |
462 | 382 | </Platform> |
463 | - <Platform Name="Android64"> | |
464 | - <RemoteDir>res\drawable-small</RemoteDir> | |
465 | - <Operation>1</Operation> | |
466 | - </Platform> | |
467 | 383 | </DeployClass> |
468 | 384 | <DeployClass Name="Android_SplashImage470"> |
469 | 385 | <Platform Name="Android"> |
@@ -470,10 +386,6 @@ | ||
470 | 386 | <RemoteDir>res\drawable-normal</RemoteDir> |
471 | 387 | <Operation>1</Operation> |
472 | 388 | </Platform> |
473 | - <Platform Name="Android64"> | |
474 | - <RemoteDir>res\drawable-normal</RemoteDir> | |
475 | - <Operation>1</Operation> | |
476 | - </Platform> | |
477 | 389 | </DeployClass> |
478 | 390 | <DeployClass Name="Android_SplashImage640"> |
479 | 391 | <Platform Name="Android"> |
@@ -480,10 +392,6 @@ | ||
480 | 392 | <RemoteDir>res\drawable-large</RemoteDir> |
481 | 393 | <Operation>1</Operation> |
482 | 394 | </Platform> |
483 | - <Platform Name="Android64"> | |
484 | - <RemoteDir>res\drawable-large</RemoteDir> | |
485 | - <Operation>1</Operation> | |
486 | - </Platform> | |
487 | 395 | </DeployClass> |
488 | 396 | <DeployClass Name="Android_SplashImage960"> |
489 | 397 | <Platform Name="Android"> |
@@ -490,10 +398,6 @@ | ||
490 | 398 | <RemoteDir>res\drawable-xlarge</RemoteDir> |
491 | 399 | <Operation>1</Operation> |
492 | 400 | </Platform> |
493 | - <Platform Name="Android64"> | |
494 | - <RemoteDir>res\drawable-xlarge</RemoteDir> | |
495 | - <Operation>1</Operation> | |
496 | - </Platform> | |
497 | 401 | </DeployClass> |
498 | 402 | <DeployClass Name="Android_Strings"> |
499 | 403 | <Platform Name="Android"> |
@@ -500,10 +404,6 @@ | ||
500 | 404 | <RemoteDir>res\values</RemoteDir> |
501 | 405 | <Operation>1</Operation> |
502 | 406 | </Platform> |
503 | - <Platform Name="Android64"> | |
504 | - <RemoteDir>res\values</RemoteDir> | |
505 | - <Operation>1</Operation> | |
506 | - </Platform> | |
507 | 407 | </DeployClass> |
508 | 408 | <DeployClass Name="DebugSymbols"> |
509 | 409 | <Platform Name="iOSSimulator"> |
@@ -573,9 +473,6 @@ | ||
573 | 473 | <Platform Name="Android"> |
574 | 474 | <Operation>0</Operation> |
575 | 475 | </Platform> |
576 | - <Platform Name="Android64"> | |
577 | - <Operation>0</Operation> | |
578 | - </Platform> | |
579 | 476 | <Platform Name="iOSDevice32"> |
580 | 477 | <Operation>0</Operation> |
581 | 478 | </Platform> |
@@ -907,9 +804,6 @@ | ||
907 | 804 | <Platform Name="Android"> |
908 | 805 | <Operation>1</Operation> |
909 | 806 | </Platform> |
910 | - <Platform Name="Android64"> | |
911 | - <Operation>1</Operation> | |
912 | - </Platform> | |
913 | 807 | </DeployClass> |
914 | 808 | <DeployClass Name="ProjectiOSDeviceDebug"> |
915 | 809 | <Platform Name="iOSDevice32"> |
@@ -953,10 +847,6 @@ | ||
953 | 847 | <RemoteDir>library\lib\armeabi-v7a</RemoteDir> |
954 | 848 | <Operation>1</Operation> |
955 | 849 | </Platform> |
956 | - <Platform Name="Android64"> | |
957 | - <RemoteDir>library\lib\arm64-v8a</RemoteDir> | |
958 | - <Operation>1</Operation> | |
959 | - </Platform> | |
960 | 850 | <Platform Name="iOSDevice32"> |
961 | 851 | <Operation>1</Operation> |
962 | 852 | </Platform> |
@@ -24,6 +24,8 @@ | ||
24 | 24 | MNUITranslationTools: TMenuItem; |
25 | 25 | MNUITranslationManager: TMenuItem; |
26 | 26 | MNUIN1: TMenuItem; |
27 | + PopupMenu1: TPopupMenu; | |
28 | + estando1231: TMenuItem; | |
27 | 29 | procedure KESNEditorViewActivated(const AEditWindow: INTAEditWindow; const AEditView: IOTAEditView); |
28 | 30 | procedure KESNWindowNotification(const AEditWindow: INTAEditWindow; AOperation: TOperation); |
29 | 31 | procedure KIDNFileNotification(ANotifyCode: TOTAFileNotification; const AFileName: string; var ACancel: Boolean); |
@@ -30,6 +32,11 @@ | ||
30 | 32 | procedure KPMNAddMenu(const AProject: IOTAProject; const AIdentList: TStrings; const AProjectManagerMenuList: IInterfaceList; const AIsMultiSelect: Boolean); |
31 | 33 | procedure MNUIPackagesCreationToolClick(Sender: TObject); |
32 | 34 | procedure MNUITranslationManagerClick(Sender: TObject); |
35 | + procedure KESNWindowShow(const AEditWindow: INTAEditWindow; AShow, | |
36 | + ALoadedFromDesktop: Boolean); | |
37 | + procedure estando1231Click(Sender: TObject); | |
38 | + procedure PopupMenu1Popup(Sender: TObject); | |
39 | + procedure KESNWindowActivated(const AEditWindow: INTAEditWindow); | |
33 | 40 | private |
34 | 41 | { Private declarations } |
35 | 42 | procedure CreateLanguagePanel(AStatusBar: TStatusBar); |
@@ -46,8 +53,10 @@ | ||
46 | 53 | , Controls |
47 | 54 | , StdCtrls |
48 | 55 | , Graphics |
56 | + , KRK.Vcl.Menus | |
49 | 57 | , KRK.ToolsApi.Components.Utilities |
50 | 58 | , KRK.ToolsApi |
59 | + , KRK.ToolsApi.Utilities | |
51 | 60 | , KX.PackagesCreator |
52 | 61 | , KX.TranslationManager |
53 | 62 | , KX.TranslationManager.Utilities |
@@ -226,6 +235,11 @@ | ||
226 | 235 | UpdateLanguageInfo(AEditWindow.StatusBar,'Este arquivo não tem um projeto aberto na IDE'); |
227 | 236 | end; |
228 | 237 | |
238 | +procedure TDAMONotifiers.KESNWindowActivated(const AEditWindow: INTAEditWindow); | |
239 | +begin | |
240 | + OutputDebugString('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); | |
241 | +end; | |
242 | + | |
229 | 243 | procedure TDAMONotifiers.KESNWindowNotification(const AEditWindow: INTAEditWindow; AOperation: TOperation); |
230 | 244 | begin |
231 | 245 | if AOperation = opInsert then |
@@ -232,6 +246,34 @@ | ||
232 | 246 | CreateLanguagePanel(AEditWindow.StatusBar); |
233 | 247 | end; |
234 | 248 | |
249 | +// A codificação a partir daqui deve ser feita de forma que seja possivel | |
250 | +// gerenciar vários popups menus diferentes aqui, apenas um menu está sendo | |
251 | +// gerenciado. Criar um componente que gerencie ao mesmo tempo todos os menus | |
252 | +// popup (TKRKEditWindowPopUps). Este componente será no estilo TOpenDialog, que | |
253 | +// simplesmente é um wrapper a ser usado de forma visual para configurar, mas | |
254 | +// precisa ser ativado via código (TOpenDialog.Execute), chame os métodos de | |
255 | +// hook/unhook ou attach/dettach. Talvez seja bom criar estes métodos para cada | |
256 | +// menu individualmente. Isso são só ideias, pois não parece ser possível | |
257 | +// gerenciar mais de uma modificação, a não ser criando várias instâncias deste | |
258 | +// componente :/. Talvez seja melhor criar uma função individual pra cada menu, | |
259 | +// passando por parâmetro o menu adicional com seu onpopup | |
260 | + | |
261 | +type | |
262 | + TCustomControlProtectedHack = class(TCustomControl); | |
263 | + | |
264 | +procedure TDAMONotifiers.estando1231Click(Sender: TObject); | |
265 | +begin | |
266 | + Application.MessageBox('Deu certo!','Eita!',0); | |
267 | +end; | |
268 | + | |
269 | +procedure TDAMONotifiers.KESNWindowShow(const AEditWindow: INTAEditWindow; AShow, ALoadedFromDesktop: Boolean); | |
270 | +begin | |
271 | + if AShow then | |
272 | + HookEditWindowFormPopUpMenu(AEditWindow.Form.Name,PopupMenu1,TCustomControlProtectedHack(GetEditWindowFormComponents(AEditWindow).TabControl).PopupMenu) | |
273 | + else | |
274 | + UnHookEditWindowFormPopUpMenu(AEditWindow.Form.Name); | |
275 | +end; | |
276 | + | |
235 | 277 | procedure TDAMONotifiers.KIDNFileNotification(ANotifyCode: TOTAFileNotification; const AFileName: string; var ACancel: Boolean); |
236 | 278 | begin |
237 | 279 | if Assigned(GetINTAEditorServices.TopEditWindow) and (GetINTAEditorServices.TopEditWindow.StatusBar.ComponentCount = 1) then |
@@ -312,4 +354,39 @@ | ||
312 | 354 | TFormTranslationManager.ShowMe; |
313 | 355 | end; |
314 | 356 | |
357 | +procedure TDAMONotifiers.PopupMenu1Popup(Sender: TObject); | |
358 | +//var | |
359 | +// RttiType: TRttiType; | |
360 | +// RttiProperty: TRttiProperty; | |
361 | +// TabIndex: Integer; | |
362 | +// Items: TStringList; | |
363 | +begin | |
364 | +// with TRttiContext.Create do | |
365 | +// try | |
366 | +// RttiType := GetType(TPopUpMenu(Sender).PopupComponent.ClassInfo); | |
367 | +// | |
368 | +// RttiProperty := RttiType.GetProperty('TabIndex'); | |
369 | +// TabIndex := RttiProperty.GetValue(TPopUpMenu(Sender).PopupComponent).AsInteger; | |
370 | +// | |
371 | +// RttiProperty := RttiType.GetProperty('Items'); | |
372 | +// Items := TStringList(RttiProperty.GetValue(TPopUpMenu(Sender).PopupComponent).AsObject); | |
373 | +// | |
374 | +// if Items[TabIndex] <> 'Welcome Page' then | |
375 | +// if not Assigned(TPopUpMenu(Sender).Items.Find('Testando: 1, 2, 3!')) then | |
376 | +// TPopUpMenu(Sender).Items.Add(NewOwnedItem(TPopUpMenu(Sender) | |
377 | +// ,estando1231.Caption | |
378 | +// ,estando1231.ShortCut | |
379 | +// ,estando1231.Checked | |
380 | +// ,estando1231.Enabled | |
381 | +// ,estando1231.OnClick | |
382 | +// ,estando1231.HelpContext | |
383 | +// ,estando1231.Name)); | |
384 | +// | |
385 | +// | |
386 | +// | |
387 | +// finally | |
388 | +// Free; | |
389 | +// end; | |
390 | +end; | |
391 | + | |
315 | 392 | end. |
@@ -141,6 +141,8 @@ | ||
141 | 141 | KRK.ToolsApi.Components.IDEMainMenu.Editors in '..\..\src\ToolsAPI\Components\KRK.ToolsApi.Components.IDEMainMenu.Editors.pas', |
142 | 142 | KRK.Vcl.ComCtrls.Editors in '..\..\src\Vcl\KRK.Vcl.ComCtrls.Editors.pas', |
143 | 143 | KRK.Vcl.ExtCtrls.Editors in '..\..\src\Vcl\KRK.Vcl.ExtCtrls.Editors.pas', |
144 | - KRK.ToolsApi.Editors.RTFLabel.CaptionEditor in '..\..\src\ToolsAPI\Editors\KRK.ToolsApi.Editors.RTFLabel.CaptionEditor.pas' {FormRTFLabelCaptionEditor}; | |
144 | + KRK.ToolsApi.Editors.RTFLabel.CaptionEditor in '..\..\src\ToolsAPI\Editors\KRK.ToolsApi.Editors.RTFLabel.CaptionEditor.pas' {FormRTFLabelCaptionEditor}, | |
145 | + KRK.Vcl.Menus in '..\..\src\Vcl\KRK.Vcl.Menus.pas', | |
146 | + KRK.ToolsAPI.Utilities in '..\..\src\ToolsAPI\KRK.ToolsAPI.Utilities.pas'; | |
145 | 147 | |
146 | 148 | end. |
@@ -165,6 +165,8 @@ | ||
165 | 165 | <Form>FormRTFLabelCaptionEditor</Form> |
166 | 166 | <FormType>dfm</FormType> |
167 | 167 | </DCCReference> |
168 | + <DCCReference Include="..\..\src\Vcl\KRK.Vcl.Menus.pas"/> | |
169 | + <DCCReference Include="..\..\src\ToolsAPI\KRK.ToolsAPI.Utilities.pas"/> | |
168 | 170 | <BuildConfiguration Include="Base"> |
169 | 171 | <Key>Base</Key> |
170 | 172 | </BuildConfiguration> |
@@ -266,10 +268,6 @@ | ||
266 | 268 | <RemoteDir>classes</RemoteDir> |
267 | 269 | <Operation>1</Operation> |
268 | 270 | </Platform> |
269 | - <Platform Name="Android64"> | |
270 | - <RemoteDir>classes</RemoteDir> | |
271 | - <Operation>1</Operation> | |
272 | - </Platform> | |
273 | 271 | </DeployClass> |
274 | 272 | <DeployClass Name="AndroidFileProvider"> |
275 | 273 | <Platform Name="Android"> |
@@ -276,10 +274,6 @@ | ||
276 | 274 | <RemoteDir>res\xml</RemoteDir> |
277 | 275 | <Operation>1</Operation> |
278 | 276 | </Platform> |
279 | - <Platform Name="Android64"> | |
280 | - <RemoteDir>res\xml</RemoteDir> | |
281 | - <Operation>1</Operation> | |
282 | - </Platform> | |
283 | 277 | </DeployClass> |
284 | 278 | <DeployClass Name="AndroidGDBServer"> |
285 | 279 | <Platform Name="Android"> |
@@ -292,10 +286,6 @@ | ||
292 | 286 | <RemoteDir>library\lib\armeabi</RemoteDir> |
293 | 287 | <Operation>1</Operation> |
294 | 288 | </Platform> |
295 | - <Platform Name="Android64"> | |
296 | - <RemoteDir>library\lib\armeabi</RemoteDir> | |
297 | - <Operation>1</Operation> | |
298 | - </Platform> | |
299 | 289 | </DeployClass> |
300 | 290 | <DeployClass Name="AndroidLibnativeArmeabiv7aFile"> |
301 | 291 | <Platform Name="Android64"> |
@@ -308,10 +298,6 @@ | ||
308 | 298 | <RemoteDir>library\lib\mips</RemoteDir> |
309 | 299 | <Operation>1</Operation> |
310 | 300 | </Platform> |
311 | - <Platform Name="Android64"> | |
312 | - <RemoteDir>library\lib\mips</RemoteDir> | |
313 | - <Operation>1</Operation> | |
314 | - </Platform> | |
315 | 301 | </DeployClass> |
316 | 302 | <DeployClass Name="AndroidServiceOutput"> |
317 | 303 | <Platform Name="Android"> |
@@ -318,10 +304,6 @@ | ||
318 | 304 | <RemoteDir>library\lib\armeabi-v7a</RemoteDir> |
319 | 305 | <Operation>1</Operation> |
320 | 306 | </Platform> |
321 | - <Platform Name="Android64"> | |
322 | - <RemoteDir>library\lib\arm64-v8a</RemoteDir> | |
323 | - <Operation>1</Operation> | |
324 | - </Platform> | |
325 | 307 | </DeployClass> |
326 | 308 | <DeployClass Name="AndroidServiceOutput_Android32"> |
327 | 309 | <Platform Name="Android64"> |
@@ -334,10 +316,6 @@ | ||
334 | 316 | <RemoteDir>res\drawable</RemoteDir> |
335 | 317 | <Operation>1</Operation> |
336 | 318 | </Platform> |
337 | - <Platform Name="Android64"> | |
338 | - <RemoteDir>res\drawable</RemoteDir> | |
339 | - <Operation>1</Operation> | |
340 | - </Platform> | |
341 | 319 | </DeployClass> |
342 | 320 | <DeployClass Name="AndroidSplashStyles"> |
343 | 321 | <Platform Name="Android"> |
@@ -344,10 +322,6 @@ | ||
344 | 322 | <RemoteDir>res\values</RemoteDir> |
345 | 323 | <Operation>1</Operation> |
346 | 324 | </Platform> |
347 | - <Platform Name="Android64"> | |
348 | - <RemoteDir>res\values</RemoteDir> | |
349 | - <Operation>1</Operation> | |
350 | - </Platform> | |
351 | 325 | </DeployClass> |
352 | 326 | <DeployClass Name="AndroidSplashStylesV21"> |
353 | 327 | <Platform Name="Android"> |
@@ -354,10 +328,6 @@ | ||
354 | 328 | <RemoteDir>res\values-v21</RemoteDir> |
355 | 329 | <Operation>1</Operation> |
356 | 330 | </Platform> |
357 | - <Platform Name="Android64"> | |
358 | - <RemoteDir>res\values-v21</RemoteDir> | |
359 | - <Operation>1</Operation> | |
360 | - </Platform> | |
361 | 331 | </DeployClass> |
362 | 332 | <DeployClass Name="Android_Colors"> |
363 | 333 | <Platform Name="Android"> |
@@ -364,10 +334,6 @@ | ||
364 | 334 | <RemoteDir>res\values</RemoteDir> |
365 | 335 | <Operation>1</Operation> |
366 | 336 | </Platform> |
367 | - <Platform Name="Android64"> | |
368 | - <RemoteDir>res\values</RemoteDir> | |
369 | - <Operation>1</Operation> | |
370 | - </Platform> | |
371 | 337 | </DeployClass> |
372 | 338 | <DeployClass Name="Android_DefaultAppIcon"> |
373 | 339 | <Platform Name="Android"> |
@@ -374,10 +340,6 @@ | ||
374 | 340 | <RemoteDir>res\drawable</RemoteDir> |
375 | 341 | <Operation>1</Operation> |
376 | 342 | </Platform> |
377 | - <Platform Name="Android64"> | |
378 | - <RemoteDir>res\drawable</RemoteDir> | |
379 | - <Operation>1</Operation> | |
380 | - </Platform> | |
381 | 343 | </DeployClass> |
382 | 344 | <DeployClass Name="Android_LauncherIcon144"> |
383 | 345 | <Platform Name="Android"> |
@@ -384,10 +346,6 @@ | ||
384 | 346 | <RemoteDir>res\drawable-xxhdpi</RemoteDir> |
385 | 347 | <Operation>1</Operation> |
386 | 348 | </Platform> |
387 | - <Platform Name="Android64"> | |
388 | - <RemoteDir>res\drawable-xxhdpi</RemoteDir> | |
389 | - <Operation>1</Operation> | |
390 | - </Platform> | |
391 | 349 | </DeployClass> |
392 | 350 | <DeployClass Name="Android_LauncherIcon36"> |
393 | 351 | <Platform Name="Android"> |
@@ -394,10 +352,6 @@ | ||
394 | 352 | <RemoteDir>res\drawable-ldpi</RemoteDir> |
395 | 353 | <Operation>1</Operation> |
396 | 354 | </Platform> |
397 | - <Platform Name="Android64"> | |
398 | - <RemoteDir>res\drawable-ldpi</RemoteDir> | |
399 | - <Operation>1</Operation> | |
400 | - </Platform> | |
401 | 355 | </DeployClass> |
402 | 356 | <DeployClass Name="Android_LauncherIcon48"> |
403 | 357 | <Platform Name="Android"> |
@@ -404,10 +358,6 @@ | ||
404 | 358 | <RemoteDir>res\drawable-mdpi</RemoteDir> |
405 | 359 | <Operation>1</Operation> |
406 | 360 | </Platform> |
407 | - <Platform Name="Android64"> | |
408 | - <RemoteDir>res\drawable-mdpi</RemoteDir> | |
409 | - <Operation>1</Operation> | |
410 | - </Platform> | |
411 | 361 | </DeployClass> |
412 | 362 | <DeployClass Name="Android_LauncherIcon72"> |
413 | 363 | <Platform Name="Android"> |
@@ -414,10 +364,6 @@ | ||
414 | 364 | <RemoteDir>res\drawable-hdpi</RemoteDir> |
415 | 365 | <Operation>1</Operation> |
416 | 366 | </Platform> |
417 | - <Platform Name="Android64"> | |
418 | - <RemoteDir>res\drawable-hdpi</RemoteDir> | |
419 | - <Operation>1</Operation> | |
420 | - </Platform> | |
421 | 367 | </DeployClass> |
422 | 368 | <DeployClass Name="Android_LauncherIcon96"> |
423 | 369 | <Platform Name="Android"> |
@@ -424,10 +370,6 @@ | ||
424 | 370 | <RemoteDir>res\drawable-xhdpi</RemoteDir> |
425 | 371 | <Operation>1</Operation> |
426 | 372 | </Platform> |
427 | - <Platform Name="Android64"> | |
428 | - <RemoteDir>res\drawable-xhdpi</RemoteDir> | |
429 | - <Operation>1</Operation> | |
430 | - </Platform> | |
431 | 373 | </DeployClass> |
432 | 374 | <DeployClass Name="Android_NotificationIcon24"> |
433 | 375 | <Platform Name="Android"> |
@@ -434,10 +376,6 @@ | ||
434 | 376 | <RemoteDir>res\drawable-mdpi</RemoteDir> |
435 | 377 | <Operation>1</Operation> |
436 | 378 | </Platform> |
437 | - <Platform Name="Android64"> | |
438 | - <RemoteDir>res\drawable-mdpi</RemoteDir> | |
439 | - <Operation>1</Operation> | |
440 | - </Platform> | |
441 | 379 | </DeployClass> |
442 | 380 | <DeployClass Name="Android_NotificationIcon36"> |
443 | 381 | <Platform Name="Android"> |
@@ -444,10 +382,6 @@ | ||
444 | 382 | <RemoteDir>res\drawable-hdpi</RemoteDir> |
445 | 383 | <Operation>1</Operation> |
446 | 384 | </Platform> |
447 | - <Platform Name="Android64"> | |
448 | - <RemoteDir>res\drawable-hdpi</RemoteDir> | |
449 | - <Operation>1</Operation> | |
450 | - </Platform> | |
451 | 385 | </DeployClass> |
452 | 386 | <DeployClass Name="Android_NotificationIcon48"> |
453 | 387 | <Platform Name="Android"> |
@@ -454,10 +388,6 @@ | ||
454 | 388 | <RemoteDir>res\drawable-xhdpi</RemoteDir> |
455 | 389 | <Operation>1</Operation> |
456 | 390 | </Platform> |
457 | - <Platform Name="Android64"> | |
458 | - <RemoteDir>res\drawable-xhdpi</RemoteDir> | |
459 | - <Operation>1</Operation> | |
460 | - </Platform> | |
461 | 391 | </DeployClass> |
462 | 392 | <DeployClass Name="Android_NotificationIcon72"> |
463 | 393 | <Platform Name="Android"> |
@@ -464,10 +394,6 @@ | ||
464 | 394 | <RemoteDir>res\drawable-xxhdpi</RemoteDir> |
465 | 395 | <Operation>1</Operation> |
466 | 396 | </Platform> |
467 | - <Platform Name="Android64"> | |
468 | - <RemoteDir>res\drawable-xxhdpi</RemoteDir> | |
469 | - <Operation>1</Operation> | |
470 | - </Platform> | |
471 | 397 | </DeployClass> |
472 | 398 | <DeployClass Name="Android_NotificationIcon96"> |
473 | 399 | <Platform Name="Android"> |
@@ -474,10 +400,6 @@ | ||
474 | 400 | <RemoteDir>res\drawable-xxxhdpi</RemoteDir> |
475 | 401 | <Operation>1</Operation> |
476 | 402 | </Platform> |
477 | - <Platform Name="Android64"> | |
478 | - <RemoteDir>res\drawable-xxxhdpi</RemoteDir> | |
479 | - <Operation>1</Operation> | |
480 | - </Platform> | |
481 | 403 | </DeployClass> |
482 | 404 | <DeployClass Name="Android_SplashImage426"> |
483 | 405 | <Platform Name="Android"> |
@@ -484,10 +406,6 @@ | ||
484 | 406 | <RemoteDir>res\drawable-small</RemoteDir> |
485 | 407 | <Operation>1</Operation> |
486 | 408 | </Platform> |
487 | - <Platform Name="Android64"> | |
488 | - <RemoteDir>res\drawable-small</RemoteDir> | |
489 | - <Operation>1</Operation> | |
490 | - </Platform> | |
491 | 409 | </DeployClass> |
492 | 410 | <DeployClass Name="Android_SplashImage470"> |
493 | 411 | <Platform Name="Android"> |
@@ -494,10 +412,6 @@ | ||
494 | 412 | <RemoteDir>res\drawable-normal</RemoteDir> |
495 | 413 | <Operation>1</Operation> |
496 | 414 | </Platform> |
497 | - <Platform Name="Android64"> | |
498 | - <RemoteDir>res\drawable-normal</RemoteDir> | |
499 | - <Operation>1</Operation> | |
500 | - </Platform> | |
501 | 415 | </DeployClass> |
502 | 416 | <DeployClass Name="Android_SplashImage640"> |
503 | 417 | <Platform Name="Android"> |
@@ -504,10 +418,6 @@ | ||
504 | 418 | <RemoteDir>res\drawable-large</RemoteDir> |
505 | 419 | <Operation>1</Operation> |
506 | 420 | </Platform> |
507 | - <Platform Name="Android64"> | |
508 | - <RemoteDir>res\drawable-large</RemoteDir> | |
509 | - <Operation>1</Operation> | |
510 | - </Platform> | |
511 | 421 | </DeployClass> |
512 | 422 | <DeployClass Name="Android_SplashImage960"> |
513 | 423 | <Platform Name="Android"> |
@@ -514,10 +424,6 @@ | ||
514 | 424 | <RemoteDir>res\drawable-xlarge</RemoteDir> |
515 | 425 | <Operation>1</Operation> |
516 | 426 | </Platform> |
517 | - <Platform Name="Android64"> | |
518 | - <RemoteDir>res\drawable-xlarge</RemoteDir> | |
519 | - <Operation>1</Operation> | |
520 | - </Platform> | |
521 | 427 | </DeployClass> |
522 | 428 | <DeployClass Name="Android_Strings"> |
523 | 429 | <Platform Name="Android"> |
@@ -524,10 +430,6 @@ | ||
524 | 430 | <RemoteDir>res\values</RemoteDir> |
525 | 431 | <Operation>1</Operation> |
526 | 432 | </Platform> |
527 | - <Platform Name="Android64"> | |
528 | - <RemoteDir>res\values</RemoteDir> | |
529 | - <Operation>1</Operation> | |
530 | - </Platform> | |
531 | 433 | </DeployClass> |
532 | 434 | <DeployClass Name="DebugSymbols"> |
533 | 435 | <Platform Name="iOSSimulator"> |
@@ -597,9 +499,6 @@ | ||
597 | 499 | <Platform Name="Android"> |
598 | 500 | <Operation>0</Operation> |
599 | 501 | </Platform> |
600 | - <Platform Name="Android64"> | |
601 | - <Operation>0</Operation> | |
602 | - </Platform> | |
603 | 502 | <Platform Name="iOSDevice32"> |
604 | 503 | <Operation>0</Operation> |
605 | 504 | </Platform> |
@@ -931,9 +830,6 @@ | ||
931 | 830 | <Platform Name="Android"> |
932 | 831 | <Operation>1</Operation> |
933 | 832 | </Platform> |
934 | - <Platform Name="Android64"> | |
935 | - <Operation>1</Operation> | |
936 | - </Platform> | |
937 | 833 | </DeployClass> |
938 | 834 | <DeployClass Name="ProjectiOSDeviceDebug"> |
939 | 835 | <Platform Name="iOSDevice32"> |
@@ -977,10 +873,6 @@ | ||
977 | 873 | <RemoteDir>library\lib\armeabi-v7a</RemoteDir> |
978 | 874 | <Operation>1</Operation> |
979 | 875 | </Platform> |
980 | - <Platform Name="Android64"> | |
981 | - <RemoteDir>library\lib\arm64-v8a</RemoteDir> | |
982 | - <Operation>1</Operation> | |
983 | - </Platform> | |
984 | 876 | <Platform Name="iOSDevice32"> |
985 | 877 | <Operation>1</Operation> |
986 | 878 | </Platform> |
@@ -124,19 +124,20 @@ | ||
124 | 124 | end; |
125 | 125 | //-///////////////////////////////////////////////////////////////////////////// |
126 | 126 | var |
127 | - MenuItemSource: TMenuItem; | |
128 | - MenuItemDestination: TMenuItem; | |
127 | + SMI: TMenuItem; // Source Menu Item | |
128 | + DMI: TMenuItem; // Destination Menu Item | |
129 | 129 | begin |
130 | 130 | if Assigned(ADestinationMainMenu) then |
131 | 131 | ADestinationMainMenu.Free; |
132 | 132 | |
133 | + // | |
133 | 134 | ADestinationMainMenu := TMainMenu.Create(ASourceMainMenu.Owner); |
134 | 135 | |
135 | - for MenuItemSource in ASourceMainMenu.Items do | |
136 | + for SMI in ASourceMainMenu.Items do | |
136 | 137 | begin |
137 | - MenuItemDestination := CloneMenuItem(MenuItemSource); | |
138 | - ADestinationMainMenu.Items.Add(MenuItemDestination); | |
139 | - GoInside(MenuItemSource,MenuItemDestination); | |
138 | + DMI := CloneMenuItem(SMI); | |
139 | + ADestinationMainMenu.Items.Add(DMI); | |
140 | + GoInside(SMI,DMI); | |
140 | 141 | end; |
141 | 142 | end; |
142 | 143 |
@@ -18,10 +18,27 @@ | ||
18 | 18 | TOnWindowNotification = procedure (const AEditWindow: INTAEditWindow; AOperation: TOperation) of object; |
19 | 19 | TOnWindowShow = procedure (const AEditWindow: INTAEditWindow; AShow: Boolean; ALoadedFromDesktop: Boolean) of object; |
20 | 20 | |
21 | - // A interface IOTAEditorNotifier não funciona, por isso ela foi removida. Não | |
22 | - // testei para saber se ela funciona em Delphis mais antigos, porém a | |
23 | - // interface INTAEditServicesNotifier funciona no Delphi 2006 e sendo assim | |
24 | - // ela substitui com vantagem a interface IOTAEditorNotifier | |
21 | + // Para que a interface IOTAEditorNotifier possa ser registrada, é necessária | |
22 | + // uma instância de IOTAEditor, o qual possui um método AddNotifier | |
23 | + // responsável pelo registro. IOTAEditor NÃO É uma interface global disponível | |
24 | + // desde a inicialização da IDE, mas sim uma interface que depende diretamente | |
25 | + // de arquivos abertos, portanto, para conseguir uma instância de IOTAEditor é | |
26 | + // necessário utilizar outros notificadores, como por exemplo, o | |
27 | + // TKRKOTAIDENotifier. Este notificador possui um evento OnFileNotification | |
28 | + // que é disparado com ações relativas a arquivos abertos, onde um dos | |
29 | + // parâmetros do seu manipulador é o caminho completo do arquivo em questão. | |
30 | + // De posse desse nome, utiliza-se a função "GetIOTAModuleFromFileName" para | |
31 | + // obter o IOTAModule correspondente ao arquivo. A partir do IOTAModule é | |
32 | + // possível varrer a lista de IOTAEditores associados (propriedade | |
33 | + // ModuleFileEditors) e assim, para cada um deles, executar o método | |
34 | + // AddNotifier. Isso é apenas uma forma de fazer. Devem haver outros | |
35 | + // notificadores que consigam, em algum ponto, fornecer um IOTAEditor um, no | |
36 | + // caso, uma lista deles. No futuro, caso seja útil um componente em cima de | |
37 | + // IOTAEditorNotifier, crie propriedades para conectá-lo a outros editores | |
38 | + // (como o TKRKOTAIDENotifier) de forma que tudo o que foi explicado aqui, | |
39 | + // ocorra automaticamente. A interface INTAEditServicesNotifier (abaixo) | |
40 | + // funciona no Delphi 2006 e aparentemente ela substitui com vantagem a | |
41 | + // interface IOTAEditorNotifier | |
25 | 42 | |
26 | 43 | //: Classe do componente que implementa a interface INTAEditServicesNotifier |
27 | 44 | TKRKCustomNTAEditServicesNotifier = class(TKRKOTANotifier |
@@ -43,6 +60,9 @@ | ||
43 | 60 | procedure DockFormVisibleChanged(const EditWindow: INTAEditWindow; DockForm: TDockableForm); |
44 | 61 | procedure EditorViewActivated(const EditWindow: INTAEditWindow; const EditView: IOTAEditView); |
45 | 62 | procedure EditorViewModified(const EditWindow: INTAEditWindow; const EditView: IOTAEditView); |
63 | + // O procedure abaixo parece nunca ser executado, portanto, o evento | |
64 | + // OnWindowActivated não funciona. Eu não sei se o fato de eu estar | |
65 | + // manipulando algo no OnEditorViewActivated, anula esta evento | |
46 | 66 | procedure WindowActivated(const EditWindow: INTAEditWindow); |
47 | 67 | procedure WindowCommand(const EditWindow: INTAEditWindow; Command: Integer; Param: Integer; var Handled: Boolean); |
48 | 68 | procedure WindowNotification(const EditWindow: INTAEditWindow; Operation: TOperation); |
@@ -53,6 +73,14 @@ | ||
53 | 73 | property OnDockFormRefresh: TOnDockFormRefresh read FOnDockFormRefresh write FOnDockFormRefresh; |
54 | 74 | property OnDockFormUpdated: TOnDockFormUpdated read FOnDockFormUpdated write FOnDockFormUpdated; |
55 | 75 | property OnDockFormVisibleChanged: TOnDockFormVisibleChanged read FOnDockFormVisibleChanged write FOnDockFormVisibleChanged; |
76 | + //: Este evento é executado sempre que uma visão de edição é ativada. Cada | |
77 | + //: IOTAModule pode ter de 1 a 3 IOTAEditView que são alteradas por meio do | |
78 | + //: TabSet existente na parte inferior da jenela de edição. Este evento | |
79 | + //: também é disparado quando se alterna entre IOTAModules (usando o TabSet | |
80 | + //: do topo da janela de edição), como consequência de haver um novo | |
81 | + //: IOTAEditView sendo ativado. Este evento não é disparado quando a tela | |
82 | + //: de boas vindas do delphi é exibida porque esta tela não possui nenhum | |
83 | + //: IOTAModule e consequentemenet nenhum IOTAEditView | |
56 | 84 | property OnEditorViewActivated: TOnEditorViewActivated read FOnEditorViewActivated write FOnEditorViewActivated; |
57 | 85 | property OnEditorViewModified: TOnEditorViewModified read FOnEditorViewModified write FOnEditorViewModified; |
58 | 86 | property OnWindowActivated: TOnWindowActivated read FOnWindowActivated write FOnWindowActivated; |
@@ -0,0 +1,179 @@ | ||
1 | +unit KRK.ToolsAPI.Utilities; | |
2 | + | |
3 | +interface | |
4 | + | |
5 | +uses Menus | |
6 | + , Classes | |
7 | + , Controls | |
8 | + , Tabs | |
9 | + , ToolsApi; | |
10 | + | |
11 | +type | |
12 | + TEditWindowFormPopUpMenuHook = class | |
13 | + private | |
14 | + FAddOnPopUpMenu: TPopUpMenu; | |
15 | + FOriginalPopUpMenu: TPopUpMenu; | |
16 | + FOriginalDoPopup: TNotifyEvent; | |
17 | + FEditWindowFormName: String; | |
18 | + procedure DoPopUp(ASender: TObject); | |
19 | + public | |
20 | + constructor Create(AEditWindowFormName: String; AAddOnPopUpMenu: TPopUpMenu; AOriginalPopUpMenu: TPopUpMenu); | |
21 | + destructor Destroy; override; | |
22 | + // Supostamente único dentre todas as janelas de edição abertas na mesma | |
23 | + // instância do Delphi | |
24 | + property EditWindowFormName: String read FEditWindowFormName; | |
25 | + end; | |
26 | + | |
27 | + TEditWindowFormComponents = record | |
28 | + // Abas no topo da janela do editor | |
29 | + // No Delphi Rio: | |
30 | + // TCustomControl->TGradientTabSet->TIDEGradientTabSet (Components[20]) | |
31 | + TabControl: TCustomControl; | |
32 | + // Abas na parte inferior da janela de edição | |
33 | + // No Delphi Rio: | |
34 | + // TTabSet (Components[41]) | |
35 | + ViewBar: TTabSet; | |
36 | + // Editor de código, reutilizado por cada IOTAEditor, de cada IOTAModule | |
37 | + // No Delphi Rio: | |
38 | + // TCustomControl->TCustomEditControl->TEditControl (Components[90]) | |
39 | + Editor: TCustomControl | |
40 | + end; | |
41 | + | |
42 | +function GetEditWindowFormComponents(AEditWindow: INTAEditWindow): TEditWindowFormComponents; | |
43 | +//: Use esta função para obter o caption da aba selecionada tanto no TabSet | |
44 | +//: superior da janela de edição, como no inferior. O superior é um | |
45 | +//: TIDEGradientTabSet e o inferior é um TTabSet propriamente dito | |
46 | +function GetActiveTabCaption(ATabControl: TCustomControl): String; | |
47 | +procedure HookEditWindowFormPopUpMenu(AEditWindowFormName: String; AAddOnPopUpMenu: TPopUpMenu; AOriginalPopUpMenu: TPopUpMenu); | |
48 | +procedure UnHookEditWindowFormPopUpMenu(AEditWindowFormName: String); | |
49 | + | |
50 | +implementation | |
51 | + | |
52 | +uses Contnrs | |
53 | + , Rtti; | |
54 | + | |
55 | +var | |
56 | + HookedPopUpMenus: TObjectList = nil; | |
57 | + | |
58 | +function GetEditWindowFormComponents(AEditWindow: INTAEditWindow): TEditWindowFormComponents; | |
59 | +begin | |
60 | + Result.TabControl := TCustomControl(AEditWindow.Form.Components[20]); | |
61 | + Result.ViewBar := TTabSet(AEditWindow.Form.Components[41]); | |
62 | + Result.Editor := TCustomControl(AEditWindow.Form.Components[90]); | |
63 | +end; | |
64 | + | |
65 | +function GetActiveTabCaption(ATabControl: TCustomControl): String; | |
66 | +var | |
67 | + RttiType: TRttiType; | |
68 | + RttiProperty: TRttiProperty; | |
69 | + TabIndex: Integer; | |
70 | + Items: TStringList; | |
71 | +begin | |
72 | + with TRttiContext.Create do | |
73 | + try | |
74 | + RttiType := GetType(ATabControl.ClassInfo); | |
75 | + | |
76 | + RttiProperty := RttiType.GetProperty('TabIndex'); | |
77 | + TabIndex := RttiProperty.GetValue(ATabControl).AsInteger; | |
78 | + | |
79 | + RttiProperty := RttiType.GetProperty('Items'); | |
80 | + Items := TStringList(RttiProperty.GetValue(ATabControl).AsObject); | |
81 | + | |
82 | + Result := Items[TabIndex]; | |
83 | + finally | |
84 | + Free; | |
85 | + end; | |
86 | +end; | |
87 | + | |
88 | +procedure HookEditWindowFormPopUpMenu(AEditWindowFormName: String; AAddOnPopUpMenu: TPopUpMenu; AOriginalPopUpMenu: TPopUpMenu); | |
89 | +var | |
90 | + O: TObject; | |
91 | +begin | |
92 | + if not Assigned(HookedPopUpMenus) then | |
93 | + HookedPopUpMenus := TObjectList.Create; | |
94 | + | |
95 | + for O in HookedPopUpMenus do | |
96 | + if TEditWindowFormPopUpMenuHook(O).EditWindowFormName = AEditWindowFormName then | |
97 | + Exit; | |
98 | + | |
99 | + HookedPopUpMenus.Add(TEditWindowFormPopUpMenuHook.Create(AEditWindowFormName,AAddOnPopUpMenu,AOriginalPopUpMenu)); | |
100 | +end; | |
101 | + | |
102 | +procedure UnHookEditWindowFormPopUpMenu(AEditWindowFormName: String); | |
103 | +var | |
104 | + O: TObject; | |
105 | +begin | |
106 | + if Assigned(HookedPopUpMenus) then | |
107 | + for O in HookedPopUpMenus do | |
108 | + if TEditWindowFormPopUpMenuHook(O).EditWindowFormName = AEditWindowFormName then | |
109 | + begin | |
110 | + HookedPopUpMenus.Remove(O); | |
111 | + Exit; | |
112 | + end; | |
113 | +end; | |
114 | + | |
115 | +{ TEditWindowFormPopUpMenuHook } | |
116 | + | |
117 | +constructor TEditWindowFormPopUpMenuHook.Create(AEditWindowFormName: String; AAddOnPopUpMenu: TPopUpMenu; AOriginalPopUpMenu: TPopUpMenu); | |
118 | +begin | |
119 | + FEditWindowFormName := AEditWindowFormName; | |
120 | + FAddOnPopUpMenu := AAddOnPopUpMenu; | |
121 | + FOriginalPopUpMenu := AOriginalPopUpMenu; | |
122 | + // Realiza o desvio do evento OnPopUp original | |
123 | + FOriginalDoPopup := FOriginalPopUpMenu.OnPopup; | |
124 | + FOriginalPopUpMenu.OnPopup := DoPopUp; | |
125 | +end; | |
126 | + | |
127 | +destructor TEditWindowFormPopUpMenuHook.Destroy; | |
128 | +begin | |
129 | + FOriginalPopUpMenu.OnPopup := FOriginalDoPopup; | |
130 | + | |
131 | + inherited; | |
132 | +end; | |
133 | + | |
134 | +procedure TEditWindowFormPopUpMenuHook.DoPopUp(ASender: TObject); | |
135 | +var | |
136 | + MI: TMenuItem; | |
137 | +begin | |
138 | + // 1. Remove todos os menus adicionais. Todos os itens de menu adicionais tem | |
139 | + // Tag = -1, portanto, varre-se todo o menu original e remove todos aqueles | |
140 | + // que possuem este tag. A remoção deixa o item de menu órfão, então | |
141 | + // colocamos este item de menu no menu adicional. A operação de remoção não | |
142 | + // exclui o item de menu, apenas o move de volta para o menu adicional, | |
143 | + // para que, posteriormente ele seja readicionado. Isso evita ter de criar | |
144 | + // instâncias adicionais de TMenuItem a cada OnPopUp além de permitir que | |
145 | + // estruturas inteiras de menus e submenus sejam adicionadas! | |
146 | + for MI in FOriginalPopUpMenu.Items do | |
147 | + begin | |
148 | + if MI.Tag = -1 then | |
149 | + begin | |
150 | + FOriginalPopUpMenu.Items.Remove(MI); | |
151 | + FAddOnPopUpMenu.Items.Add(MI); | |
152 | + end; | |
153 | + end; | |
154 | + // 2. Executa o manipulador do evento OnPopUp original. Neste manipulador os | |
155 | + // itens originais do menu são adicionados/manipulados pela IDE. Não | |
156 | + // executar isso faz com que o menu original nunca apareça | |
157 | + FOriginalDoPopup(ASender); | |
158 | + // 3. Adiciona todos os menus contidos em FAddOnPopUpMenu, mas apenas se a aba | |
159 | + // ativa não for a aba de boas vindas | |
160 | + após abrir uma janele de edição adiciol, o while abaixo funcionou porque o menu esta vazio, pq ele foi esvaziado ao ser exibido na janela de edição principal da ide | |
161 | + if GetActiveTabCaption(TCustomControl(TPopUpMenu(ASender).PopupComponent)) <> 'Welcome Page' then | |
162 | + while FAddOnPopUpMenu.Items.Count > 0 do | |
163 | + begin | |
164 | + MI := FAddOnPopUpMenu.Items[0]; | |
165 | + MI.Tag := -1; | |
166 | + | |
167 | + FAddOnPopUpMenu.Items.Remove(MI); | |
168 | + FOriginalPopUpMenu.Items.Add(MI); | |
169 | + end; | |
170 | +end; | |
171 | + | |
172 | +initialization | |
173 | + | |
174 | +finalization | |
175 | + | |
176 | +if Assigned(HookedPopUpMenus) then | |
177 | + HookedPopUpMenus.Free; | |
178 | + | |
179 | +end. |
@@ -0,0 +1,29 @@ | ||
1 | +unit KRK.Vcl.Menus; | |
2 | +{$IF CompilerVersion >= 25}{$LEGACYIFEND ON}{$IFEND} { Delphi XE4 } | |
3 | +interface | |
4 | + | |
5 | +uses Menus | |
6 | + , Classes; | |
7 | + | |
8 | +function NewOwnedItem(AOwner: TComponent; const ACaption: string; AShortCut: TShortCut; AChecked, AEnabled: Boolean; AOnClick: TNotifyEvent; hCtx: THelpContext; const AName: string): TMenuItem; | |
9 | + | |
10 | +implementation | |
11 | + | |
12 | +function NewOwnedItem(AOwner: TComponent; const ACaption: string; AShortCut: TShortCut; AChecked, AEnabled: Boolean; AOnClick: TNotifyEvent; hCtx: THelpContext; const AName: string): TMenuItem; | |
13 | +begin | |
14 | + Result := TMenuItem.Create(AOwner); | |
15 | + | |
16 | + with Result do | |
17 | + begin | |
18 | + Caption := ACaption; | |
19 | + ShortCut := AShortCut; | |
20 | + OnClick := AOnClick; | |
21 | + HelpContext := hCtx; | |
22 | + Checked := AChecked; | |
23 | + Enabled := AEnabled; | |
24 | + Name := AName; | |
25 | + end; | |
26 | +end; | |
27 | + | |
28 | + | |
29 | +end. |