CE Find.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /******************************************************************************/
  2. #if EE_PRIVATE
  3. namespace Edit{
  4. /******************************************************************************/
  5. STRUCT(Find , Region)
  6. //{
  7. enum MODE
  8. {
  9. EXACT ,
  10. NEAREST,
  11. FILES ,
  12. };
  13. enum SCOPE
  14. {
  15. CUR_FILE=1<<0,
  16. ACT_APP =1<<1,
  17. ESENTHEL=1<<2,
  18. ALL =CUR_FILE|ACT_APP|ESENTHEL,
  19. };
  20. STRUCT(ResultRegion , Region)
  21. //{
  22. struct Result
  23. {
  24. Bool opened;
  25. Str text;
  26. SourceLoc source_loc;
  27. SymbolPtr symbol;
  28. Int priority, line;
  29. Memx<Result> children;
  30. Result() {opened=false; priority=0; line=-1;}
  31. Result& set (Bool skip_ee, C Str &t, C SymbolPtr &symbol , Int priority=0) {T.text=PathToSymbol(skip_ee ? SkipStartPath(t, "EE") : t); T.symbol=symbol; T.priority=priority; return T;}
  32. Result& setText( C Str &t, C SourceLoc &source_loc, Int line =-1) {T.text= t ; T.source_loc=source_loc; T.line=line; return T;}
  33. };
  34. Memx<Result> data;
  35. List<Result> list;
  36. void create ();
  37. void resize ();
  38. void find (C Str &t, Bool case_sensitive, Bool whole_words, MODE mode, UInt scope, Bool skip_ee);
  39. void setData();
  40. virtual void update (C GuiPC &gpc);
  41. };
  42. static Bool FilterScope(Source *source, UInt scope);
  43. Int history_pos;
  44. Memc<Str> history;
  45. TextLine text;
  46. Button prev, next, close, case_sensitive, whole_words, cur_file, active_app, engine, skip_ee;
  47. Tabs mode;
  48. ResultRegion result;
  49. UInt scope()C {return (cur_file() ? CUR_FILE : 0)|(active_app() ? ACT_APP : 0)|(engine() ? ESENTHEL : 0);}
  50. void create ();
  51. void resize ();
  52. void find ();
  53. void findPrev ();
  54. void findNext ();
  55. void toggle ();
  56. void historyAdd(C Str &text);
  57. void historySet(Int delta);
  58. virtual Find& hide ();
  59. virtual Find& show ();
  60. virtual Find& activate ();
  61. virtual Find& moveToTop () {result.moveToTop(); super::moveToTop(); return T;}
  62. virtual void update (C GuiPC &gpc);
  63. };
  64. /******************************************************************************/
  65. STRUCT(ReplaceText , ClosableWindow)
  66. //{
  67. Text t_src, t_dest, t_scope;
  68. TextLine src, dest;
  69. ComboBox scope;
  70. Button case_sensitive, whole_words, replace, cancel;
  71. Menu menu;
  72. void create ();
  73. void process();
  74. virtual ReplaceText& show ();
  75. };
  76. /******************************************************************************/
  77. void FindPrev(Find &find);
  78. void FindNext(Find &find);
  79. /******************************************************************************/
  80. } // namespace
  81. #endif
  82. /******************************************************************************/