TSE: tse.ui: How to quickly switch between different menu options: Method: Conditional Compiling: #DEFINE ... #IFDEF ... #ELSE ... #ENDIF

5 views
Skip to first unread message

knud van eeden

unread,
Dec 5, 2025, 7:24:31 PM (2 days ago) Dec 5
to SemWare TSE Pro Text Editor
 Q. TSE: tse.ui: How to quickly switch between different menu options: Method: Conditional Compiling: #DEFINE ... #IFDEF ... #ELSE ... #ENDIF

Of course you can use the same method on TSE for Linux but also similarly on TSE for Microsoft Windows
(e.g. your own menu options combined versus the original TSE menu options.
Then by recompiling you can quickly switch and activate those menu options of interest.

Method:

1. -In the first option you put e.g. your own menu options, in the
    second option you put the original TSE menu options.

2. -Then enable #DEFINE or disable it (e.g. by puttin /* ... */ around
    it. Using // does not work here.

3. -Then recompile. After recompilation are or the menus option 1 active
    or the menus option 2 active.

4. -So you can very easily switch between 2 different sets of menu
    options.

===

Steps:

1. Backup the tse.ui you are using

2. You might use this tse.ui from Linux and combine with the tse.ui from Microsoft Windows

3. Create a #DEFINE with an arbitrary name (e.g. 'knud', e.g. <yourname>, ...

/*
#DEFINE knud 1
*/

4. Now put around the 2 menus a #IFDEF #ELSE #ENDIF

#IFDEF knud

// here comes option 1

menu FileMenu()
    history

    "Ne&w"                          ,   NewFile()
    "&Open..."                      ,   EditThisFile()
    // debug further "&Load..."                         ,   PROCMacroRunPurge( "editfibu" ) // new: operation: file: load: edit + add 'bbc\taal\' and 'knud\' to history first [kn, ni, tu, 22-07-2003 13:25:51]
    "&Insert..."                    ,   InsertFile()        ,   BrowseModeMenuFlags()
    "&File Manager..."              ,   ExecMacro("f -r")
    "Print  "                      ,   PrintMenu()
    ""                              ,                       ,   Divide
    "&Next"                         ,   NextFile()          ,   NumFilesMenuFlags()
    "&Previous"                     ,   PrevFile()          ,   NumFilesMenuFlags()
    "Lis&t Open..."                 ,   ExecMacro("listopen")
    "List &Recent..."               ,   mListRecentFiles()
    "Current File"                  ,                       ,   Divide
    "&Save"                         ,   SaveFile()          ,   BrowseModeMenuFlags()
    "Save &As..."                   ,   RenameAndSaveFile()
    // "Save && C&lose"                ,   SaveAndQuitFile()   ,   BrowseModeMenuFlags()
    // "&Close"                        ,   QuitFile()
    "&Close"                        ,   ExecMacro( "exitfiqc" ) // [kn, ri, fr, 05-12-2025 20:22:58]
    "Chan&ge Name..."               ,   ChangeCurrFilename()
    "S&how File Info"               ,   ExecMacro("fileinfo")
    "All Files"                     ,                       ,   Divide
    "Sa&ve All"                     ,   SaveAllFiles()
    "Save All && &Exit"             ,   SaveAllAndExit()
    "E&xit"                         ,   FancyExit()
end

#ELSE

// here comes option 2

menu FileMenu()
    history

    "Ne&w"                          ,   NewFile()
    "&Open..."                      ,   EditThisFile()
    "&Insert..."                    ,   InsertFile()        ,   BrowseModeMenuFlags()
    "&File Manager..."              ,   ExecMacro("f -r")
    "Print  "                      ,   PrintMenu()
    ""                              ,                       ,   Divide
    "&Next"                         ,   NextFile()          ,   NumFilesMenuFlags()
    "&Previous"                     ,   PrevFile()          ,   NumFilesMenuFlags()
    "Lis&t Open..."                 ,   ExecMacro("listopen")
    "List &Recent..."               ,   mListRecentFiles()
    "Current File"                  ,                       ,   Divide
    "&Save"                         ,   SaveFile()          ,   BrowseModeMenuFlags()
    "Save &As..."                   ,   RenameAndSaveFile()
    "Save && C&lose"                ,   SaveAndQuitFile()   ,   BrowseModeMenuFlags()
    "&Close"                        ,   QuitFile()
    "Chan&ge Name..."               ,   ChangeCurrFilename()
    "S&how File Info"               ,   ExecMacro("fileinfo")
    "All Files"                     ,                       ,   Divide
    "Sa&ve All"                     ,   SaveAllFiles()
    "Save All && &Exit"             ,   SaveAllAndExit()
    "E&xit"                         ,   FancyExit()
end

#ENDIF

...

#IFDEF knud

// here comes option 1

menu SearchMenu()
    history

    "&Find..."                      ,   Find()
    "&Replace..."                   ,   Replace(),      BrowseModeMenuFlags()
    "&Again"                        ,   RepeatFind()
    "Find and &Do..."               ,   ExecMacro("find&do")
    ""                              ,                       , Divide
    // "Find &Word at Cursor"          ,   mFindWordAtCursor('+') // [kn, ri, fr, 05-12-2025 21:14:20]
    "Find &Word at Cursor"          ,   ExecMacro( "searwocu" ) // [kn, ri, fr, 05-12-2025 21:14:46]
    "find/view &Word at cursor: all files", ExecMacro( "searwoca" ) // [kn, ri, fr, 05-12-2025 21:59:20]
    "find/view &All defproc/fn at cursor", ExecMacro( "seardefa" ) // [kn, ri, fr, 05-12-2025 21:59:27]
    "find/view &Defproc/fn at cursor", ExecMacro( "seardefn" ) // [kn, ri, fr, 05-12-2025 21:59:31]
    "&Incremental Search..."        ,   ExecMacro("isrch")
    "&Match"                        ,   ExecMacro("match")
    ""                              ,                       , Divide
    "Compressed &View..."           ,   mCompressView(0)
    "F&unction List..."             ,   mCompressView(1)
    "Grep i&n Files..."             ,   ExecMacro("grep")
    "R&edisplay View PickList"      ,   ViewFinds()
    ""                              ,                       , Divide
    "&Place Bookmark..."            ,   PlaceMark()
    "&Go to Bookmark..."            ,   GotoMark()
    ""                              ,                       , Divide
    "Go to &Line..."                ,   GotoLine()
    "Go to &Column..."              ,   GotoColumn()
end

#ELSE

// here comes option 2

menu SearchMenu()
    history

    "&Find..."                      ,   Find()
    "&Replace..."                   ,   Replace(),      BrowseModeMenuFlags()
    "&Again"                        ,   RepeatFind()
    "Find and &Do..."               ,   ExecMacro("find&do")
    ""                              ,                       , Divide
    "Find &Word at Cursor"          ,   mFindWordAtCursor('+') // [kn, ri, fr, 05-12-2025 21:14:20]
    "&Incremental Search..."        ,   ExecMacro("isrch")
    "&Match"                        ,   ExecMacro("match")
    ""                              ,                       , Divide
    "Compressed &View..."           ,   mCompressView(0)
    "F&unction List..."             ,   mCompressView(1)
    "Grep i&n Files..."             ,   ExecMacro("grep")
    "R&edisplay View PickList"      ,   ViewFinds()
    ""                              ,                       , Divide
    "&Place Bookmark..."            ,   PlaceMark()
    "&Go to Bookmark..."            ,   GotoMark()
    ""                              ,                       , Divide
    "Go to &Line..."                ,   GotoLine()
    "Go to &Column..."              ,   GotoColumn()
end

#ENDIF

...

5. Do this for all the TSE main menus

   'FileMenu'

   'TextMenu'

   'SearchMenu'

   'BlockMenu'

   'ClipMenu' (optionally the 'ClipMenu' but best to keep that the original in Linux. otherwise possible crash)

   'WindowMenu'

   'MacroMenu'

   'UtilMenu'

   'OptionsMenu'

   'HelpMenu'

6. Save the tse.ui

7. Keep recompile until no errors in the tse directory using

    ./sc32 -b ui/tse.ui

8. -Tested successfully
    on
    Microsoft Windows 10 Professional (64 bits)
    running
    TSE for Linux version 4.50.14
    on Linux WSL Ubuntu

with friendly greetings
Knud van Eeden

E.g. Search menu with my options versus Search menu with original menu options:


Inline image

Inline image




Reply all
Reply to author
Forward
0 new messages