//--------------------------------------------------------------------------- #include #pragma hdrstop #include "searchfrm.h" #include #include "mainfrm.h" #include //--------------------------------------------------------------------------- #pragma resource "*.dfm" TForm2 *Form2; //--------------------------------------------------------------------------- __fastcall TForm2::TForm2(TComponent* Owner) : TForm(Owner) { pvrtf = new SWDispRTF(this); pvrtf->Parent = plPreview; pvrtf->Align = alClient; pvrtf->ScrollBars = ssVertical; pvrtf->ReadOnly = true; // pvrtf->PopupMenu = PopupMenu2; // mod->Disp(*displays.insert(displays.begin(), new RTFDisp(newrtf))); // mod->SetKey(DefaultVSKey); // return 0; } //--------------------------------------------------------------------------- void __fastcall TForm2::Button1Click(TObject *Sender) { // ModMap::iterator target; class TWaitCursor { public: TWaitCursor() : oldc(Screen->Cursor) { Screen->Cursor = crHourGlass; } ~TWaitCursor() { Screen->Cursor = oldc; } private: TCursor oldc; } wait; // show hourglass Caption = ""; targetpc = Form1->textTabs->pageControl; if ((Form1->ActiveControl == Form1->PageControl2) || (IsChild(Form1->PageControl2->Handle, Form1->ActiveControl->Handle))) targetpc = Form1->PageControl2; if ((Form1->ActiveControl == Form1->PageControl3) || (IsChild(Form1->PageControl3->Handle, Form1->ActiveControl->Handle))) targetpc = Form1->PageControl3; target = Form1->mainmgr->Modules.find(targetpc->ActivePage->Caption.c_str()); if (target != Form1->mainmgr->Modules.end()) { Caption = Caption + "Searching [" + (*target).first.c_str() + "]..."; ListBox1->Clear(); int searchType; switch (searchTypeGroup->ItemIndex) { case 0: searchType = -2; break; case 1: searchType = -1; break; case 2: searchType = 0; break; } int searchOptions = (CheckBox2->Checked) ? 0 : REG_ICASE; ListKey &results = (*target).second->Search(SearchText->Text.c_str(), searchType, searchOptions); while (!results.Error()) { ListBox1->Items->Add((const char *)results); results++; } // ListBox1->Items->Pack(); // so Count is set correctly (per helpfile) Caption = ""; Caption = Caption + "Results from [" + (*target).first.c_str() + "] (" + ListBox1->Items->Count + ((ListBox1->Items->Count == 1) ? " match)" : " matches)"); } else Caption = "Error finding target module"; } //--------------------------------------------------------------------------- void __fastcall TForm2::ListBox1DblClick(TObject *Sender) { if (targetpc == Form1->PageControl3) { Form1->DictKeyEdit->Text = ListBox1->Items->Strings[ListBox1->ItemIndex].c_str(); } else { Form1->DefaultVSKey = ListBox1->Items->Strings[ListBox1->ItemIndex].c_str(); Form1->TextKeyChanged(); } } //--------------------------------------------------------------------------- void __fastcall TForm2::ListBox1Click(TObject *Sender) { if (target != Form1->mainmgr->Modules.end()) { SWKey *savekey = *(*target).second; (*target).second->SetKey(ListBox1->Items->Strings[ListBox1->ItemIndex].c_str()); pvrtf->Display(*(*target).second); (*target).second->SetKey(*savekey); } } //---------------------------------------------------------------------------