home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / SCRPTEXM.PAK / CONFIG.SPP < prev    next >
Encoding:
Text File  |  1997-05-06  |  3.8 KB  |  172 lines

  1. //--------------------------------------------------------------------------
  2. // Object Scripting
  3. // Copyright (c) 1996, 1997 by Borland International, All Rights Reserved
  4. //
  5. // CONFIG.SPP: Configure Windows. Resizes and positions IDE windows as
  6. //   they are created. Also maps keys in the default and classic keyboards
  7. //   for buffer manipulation.
  8. //
  9. // USE: Set region values in the #defines below, and run script. The
  10. //   following hotkeys are available:
  11. //     Alt-n   Next buffer
  12. //     Alt-l   Last buffer
  13. //     Alt-b   Buffer list
  14. //     Alt-x   Expand window
  15. //--------------------------------------------------------------------------
  16. print typeid(module());
  17.  
  18. //
  19. // Constants for window size/position.
  20. //
  21. #define EDITOR_LEFT    1
  22. #define EDITOR_TOP     1
  23. #define EDITOR_RIGHT   7700
  24. #define EDITOR_BOTTOM  6000
  25. #define PROJECT_LEFT   7701
  26. #define PROJECT_TOP    1
  27. #define PROJECT_RIGHT  10000
  28. #define PROJECT_BOTTOM 6000
  29. #define MESSAGE_LEFT   1
  30. #define MESSAGE_TOP    6001
  31. #define MESSAGE_RIGHT  6666
  32. #define MESSAGE_BOTTOM 10000
  33. #define WATCHES_LEFT   6667
  34. #define WATCHES_TOP    6001
  35. #define WATCHES_RIGHT  10000
  36. #define WATCHES_BOTTOM 10000
  37.  
  38. //
  39. // IDE imports.
  40. //
  41. import IDE;
  42. import editor;
  43. import debugger;
  44.  
  45. config()
  46. {
  47.   // Set region sizes.
  48.   //
  49.   IDE.SetRegion("Editor", EDITOR_LEFT, EDITOR_TOP, EDITOR_RIGHT,
  50.                 EDITOR_BOTTOM);
  51.   IDE.SetRegion("Project", PROJECT_LEFT, PROJECT_TOP, PROJECT_RIGHT,
  52.                 PROJECT_BOTTOM);
  53.   IDE.SetRegion("Message", MESSAGE_LEFT, MESSAGE_TOP, MESSAGE_RIGHT,
  54.                 MESSAGE_BOTTOM);
  55.   IDE.SetRegion("Watches", WATCHES_LEFT, WATCHES_TOP, WATCHES_RIGHT,
  56.                 WATCHES_BOTTOM);
  57.  
  58.   // Other regions that are sized/positioned by this script.
  59.   //
  60.   //IDE.SetRegion("Breakpoints",,,,);
  61.   //IDE.SetRegion("Processes",,,,);
  62.   //IDE.SetRegion("Inspector",,,,);
  63.   //IDE.SetRegion("Evaluator",,,,);
  64.   //IDE.SetRegion("CPU",,,,);
  65.   //IDE.SetRegion("Debugger",,,,);
  66.  
  67.   // Map keys for buffer manipulation.
  68.   //
  69.   MapKeys();
  70. }
  71.  
  72. //
  73. // Expand the appropriate windows when they are created. Be sure to
  74. // pass first and return the previous handler's return value.
  75. //
  76. on IDE:>DoFileOpen(FileName, ToolName, prjNode)
  77. {
  78.   declare ret = pass(FileName, ToolName, prjNode);
  79.   .ExpandWindow();
  80.   return ret;
  81. }
  82.  
  83. on IDE:>FileNew(toolName, fileName)
  84. {
  85.   declare ret = pass(toolName, fileName);
  86.   .ExpandWindow();
  87.   return ret;
  88. }
  89.  
  90. on IDE:>ViewMessage(page)
  91. {
  92.   declare ret = pass(page);
  93.   .ExpandWindow();
  94.   return ret;
  95. }
  96.  
  97. on IDE:>ViewProject()
  98. {
  99.   declare ret = pass();
  100.   .ExpandWindow();
  101.   return ret;
  102. }
  103.  
  104. on IDE:>ProjectNewProject(absPrjFileName)
  105. {
  106.   declare ret = pass(absPrjFileName);
  107.   .ExpandWindow();
  108.   return ret;
  109. }
  110.  
  111. on IDE:>DebugInspect()
  112. {
  113.   declare ret = pass();
  114.   .ExpandWindow();
  115.   return ret;
  116. }
  117.  
  118. on debugger:>Inspect(symbol)
  119. {
  120.   declare ret = pass(symbol);
  121.   IDE.ExpandWindow();
  122.   return ret;
  123. }
  124.  
  125. on debugger:>ViewCpu(address)
  126. {
  127.   declare ret = pass(address);
  128.   IDE.ExpandWindow();
  129.   return ret;
  130. }
  131.  
  132. on debugger:>ViewProcess()
  133. {
  134.   declare ret = pass();
  135.   IDE.ExpandWindow();
  136.   return ret;
  137. }
  138.  
  139. on debugger:>ViewBreakpoint()
  140. {
  141.   pass();
  142.   IDE.ExpandWindow();
  143. }
  144.  
  145. on debugger:>WatchCurrent()
  146. {
  147.   pass();
  148.   IDE.ExpandWindow();
  149. }
  150.  
  151. on debugger:>ViewWatch()
  152. {
  153.   pass();
  154.   IDE.ExpandWindow();
  155. }
  156.  
  157. //
  158. // Map keys in the default and classic keyboards for buffer manipulation.
  159. //
  160. MapKeys()
  161. {
  162.   if (IDE.KeyboardAssignmentFile == "default.kbd" ||
  163.     IDE.KeyboardAssignmentFile == "classic.kbd") {
  164.     
  165.     declare kb = IDE.KeyboardManager.GetKeyboard("Editor");
  166.     kb.Assign("<Alt-n>", "editor.NextBuffer();");
  167.     kb.Assign("<Alt-l>", "editor.PreviousBuffer();");
  168.     kb.Assign("<Alt-b>", "editor.BufferList();");
  169.     kb.Assign("<Alt-x>", "IDE.ExpandWindow();"); 
  170.   }
  171. }
  172.