Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » [FEATURE] Add submenu "Macro /Edit" to package that use usc macro (patch included)
Re: [FEATURE] Add submenu "Macro /Edit" to package that use usc macro (patch included) [message #46617 is a reply to message #46615] Mon, 13 June 2016 14:29 Go to previous messageGo to previous message
omari is currently offline  omari
Messages: 276
Registered: March 2010
Experienced Member
Hi Klugier,

Attached my macro file, you can put it in your upp directory.

in order to use macros in all projects, the macro file shall be in the theide bin directory, or in UppLocal directory.
a macro file in a package is visible only in it's package.

for more info about macro, see reference/Macro.

here the diff:
Index: C:/upp/uppsrc/ide/Common/Util.cpp
===================================================================
--- C:/upp/uppsrc/ide/Common/Util.cpp (revision 9938)
+++ C:/upp/uppsrc/ide/Common/Util.cpp (working copy)
@@ -174,6 +174,7 @@
 static void ReadMacro(CParser& p)
 {
  IdeMacro macro;
+ macro.filename = p.GetFileName();
  if(p.IsString()) {
   macro.menu = p.ReadString();
   if(p.Char(':'))
Index: C:/upp/uppsrc/ide/Core/Core.h
===================================================================
--- C:/upp/uppsrc/ide/Core/Core.h (revision 9938)
+++ C:/upp/uppsrc/ide/Core/Core.h (working copy)
@@ -152,6 +152,7 @@
  String menu;
  String submenu;
  EscValue code;
+ String filename;
 };
 
 ArrayMap<String, EscValue>& UscGlobal();
Index: C:/upp/uppsrc/ide/idebar.cpp
===================================================================
--- C:/upp/uppsrc/ide/idebar.cpp (revision 9938)
+++ C:/upp/uppsrc/ide/idebar.cpp (working copy)
@@ -289,6 +289,20 @@
      EditMacroMenu(menu, va);
    }
   }
+  
+  menu.Separator();
+  menu.Sub("Edit",
+    [&](Bar& b) {
+     SortedIndex<String> files;
+     for(int i = 0; i < mlist.GetCount(); i++) {
+      if(files.Find(mlist[i].filename) < 0) {
+       String filename = mlist[i].filename;
+       files.Add(filename);
+       b.Add(filename, [filename, this]() { EditFile(filename); } );
+      }
+     }
+    }
+   );
  }
 }
 


  • Attachment: macros.usc
    (Size: 2.24KB, Downloaded 273 times)


regards
omari.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [ACCEPTED] New file
Next Topic: Bookmarks hotkeys Ctrl+0-9 and Ctrl+Shift+0-9 dont works
Goto Forum:
  


Current Time: Mon Apr 28 14:37:54 CEST 2025

Total time taken to generate the page: 0.00797 seconds