int MemoProc (Option *opt, int n, int x, int y, char *text, int index) { // user callback for mouse events in memo static int pressed; // keep track of button 3 state int start, end, currentPV = (opt != &engoutOptions[5]); switch(n) { case 0: // pointer motion if(!pressed) return FALSE; // only motion with button 3 down is of interest MovePV(x, y, 500/*lineGap + BOARD_HEIGHT * (squareSize + lineGap)*/); break; case 3: // press button 3 pressed = 1; if(LoadMultiPV(x, y, text, index, &start, &end, currentPV)) { highTextStart[currentPV] = start; highTextEnd[currentPV] = end; HighlightText(&engoutOptions[currentPV ? 12 : 5], start, end, TRUE); } break; case -3: // release button 3 pressed = 0; if(highTextStart[currentPV] != highTextEnd[currentPV]) HighlightText(&engoutOptions[currentPV ? 12 : 5], highTextStart[currentPV], highTextEnd[currentPV], FALSE); highTextStart[currentPV] = highTextEnd[currentPV] = 0; UnLoadPV(); break; default: return FALSE; // not meant for us; do regular event handler } return TRUE; }
void IncrementalSearch::SearchText() { // fetch the entered text m_SearchText=m_pTextCtrl->GetValue(); // renew the start position, the user might have changed it by moving the caret VerifyPosition(); SetRange(); if (!m_SearchText.empty()) { // perform search m_pToolbar->EnableTool(XRCID("idIncSearchClear"), true); m_pToolbar->EnableTool(XRCID("idIncSearchPrev"), (m_flags & wxSCI_FIND_REGEXP) == 0); m_pToolbar->EnableTool(XRCID("idIncSearchNext"), true); DoSearch(m_NewPos); } else { // if no text m_pToolbar->EnableTool(XRCID("idIncSearchClear"), false); m_pToolbar->EnableTool(XRCID("idIncSearchPrev"), false); m_pToolbar->EnableTool(XRCID("idIncSearchNext"), false); // reset the backgroundcolor of the text-control m_pTextCtrl->SetBackgroundColour(m_textCtrlBG_Default); // windows does not update the backgroundcolor immediately, so we have to force it here #ifdef __WXMSW__ m_pTextCtrl->Refresh(); m_pTextCtrl->Update(); #endif } m_pToolbar->Refresh(); HighlightText(); }
void CInitBrushNameDlg::InitGadgetText(String_32* pString, BOOL resizeDialog /*= TRUE*/) { if (pString != NULL) m_strSuggest = *pString; SetStringGadgetValue(_R(IDC_EDITBRUSHNAME), *GetSuggestion(&m_strSuggest)); // change the dialog title to "Enter brush name:" // Errr, NO! This is very bad for translation! // String_256 Name = TEXT("Create new brush:"); // SetTitlebarName(&Name); // Show the help button HideGadget(_R(ID_CC_HELP_BUTTON), FALSE); // show the group info text SetStringGadgetValue(_R(IDC_STATICBRUSHGROUP), _R(IDS_BRUSHGROUP)); HideGadget(_R(IDC_STATICBRUSHGROUP), FALSE); HighlightText(_R(IDC_EDITBRUSHNAME)); SetKeyboardFocus(_R(IDC_EDITBRUSHNAME)); }
void WebAddressDlg::OnCreate() { //Set up the dialog in its initial state SetDialogInitialState(); //And put the keyboard focus in the URL edit field SetKeyboardFocus(_R(IDC_WEBADDRESS_URL)); HighlightText(_R(IDC_WEBADDRESS_URL)); }
void IncrementalSearch::DoSearchPrev() { VerifyPosition(); // (re-)define m_MinPos and m_MaxPos, they might have changed SetRange(); // we search backward from one character before the ending of the last found phrase DoSearch(m_NewPos + m_LengthFound - 1, m_MaxPos, m_MinPos); HighlightText(); }
void HighlightMove (int from, int to, Boolean highlight) { HighlightText (&historyOptions[0], from, to, highlight); }
//================================================================================================================ void MenuEditorSystem::OnMouseMove(WPARAM btnState, int x, int y) { int dX, dY, tdX, tdY; // Calculate movement delta from previous frame if (dragPrevX != -1) { dX = x - dragPrevX; dY = y - dragPrevY; tdX = x - dragStartX; tdY = y - dragStartY; } if (gridMode == GM_Snap) { XMFLOAT2 selToolPoint = SnapToGrid(x, y); m_StampNormal->TopLeftPosition() = XMFLOAT3(selToolPoint.x, selToolPoint.y, 0); m_StampHighlight->TopLeftPosition() = XMFLOAT3(selToolPoint.x, selToolPoint.y, 0); // Move a button display cover if in button mode UpdateDisplaySprite(selToolPoint.x, selToolPoint.y); // If a button or text is being moved then continue to move it MoveButton(selToolPoint.x, selToolPoint.y); MoveText(selToolPoint.x, selToolPoint.y); HighlightButton(selToolPoint.x, selToolPoint.y); HighlightText(selToolPoint.x, selToolPoint.y); } else { // Move a button display cover if in button mode UpdateDisplaySprite(x, y); // If a button or text is being moved then continue to move it MoveButton(x, y); MoveText(x, y); HighlightButton(x, y); HighlightText(x, y); } // Start a left button drag of an item if ((btnState & MK_LBUTTON) != 0) { CalculateSelectedMousePosition(x, y); stampPressed = true; // If applicable, Add a button AddButton(); // If applicable, Add a text AddText(); // Selects a button on the map and deletes it if in button delete mode DeleteButton(); // Selects a text on the map and deletes it if in text delete mode DeleteText(); } // Remember current mouse co-ordinates for next frame if (dragPrevX != -1) { dragPrevX = x; dragPrevY = y; } }
//================================================================================================================ void HUDEditorSystem::OnMouseMove(WPARAM btnState, int x, int y) { if (gridMode == GM_Snap) { XMFLOAT2 selToolPoint = SnapToGrid(x, y); m_StampNormal->TopLeftPosition() = XMFLOAT3(selToolPoint.x, selToolPoint.y, 0); m_StampHighlight->TopLeftPosition() = XMFLOAT3(selToolPoint.x, selToolPoint.y, 0); // Move a image display cover if in image mode UpdateDisplaySprite(selToolPoint.x, selToolPoint.y); // If a image or text is being moved then continue to move it MoveImage(selToolPoint.x, selToolPoint.y); MoveText(selToolPoint.x, selToolPoint.y); HighlightImage(selToolPoint.x, selToolPoint.y); HighlightText(selToolPoint.x, selToolPoint.y); } else { // Move a image display cover if in image mode UpdateDisplaySprite(x, y); // If a image or text is being moved then continue to move it MoveImage(x, y); MoveText(x, y); HighlightImage(x, y); HighlightText(x, y); } // Start a left button drag of an item if ((btnState & MK_LBUTTON) != 0) { CalculateSelectedMousePosition(x, y); stampPressed = true; // If applicable, Add a image AddImage(); // If applicable, Add a text AddText(); // Selects a image on the map and deletes it if in image delete mode DeleteImage(); // Selects a text on the map and deletes it if in text delete mode DeleteText(); } // Move a button or text display cover /*if (editMode == ET_Button && (action == A_Place || action == A_Move)) { XMFLOAT2 selToolPoint = SnapToGrid(x, y); m_StampNormal->TopLeftPosition() = XMFLOAT3(selToolPoint.x, selToolPoint.y, 0); m_StampHighlight->TopLeftPosition() = XMFLOAT3(selToolPoint.x, selToolPoint.y, 0); }*/ }
void CNameBrushDlg::InitGadgetText(String_32* pString, BOOL resizeDialog /*= TRUE*/) { if (pString != NULL) m_strSuggest = *pString; SetStringGadgetValue(_R(IDC_EDITBRUSHNAME), *GetSuggestion(&m_strSuggest)); HighlightText(_R(IDC_EDITBRUSHNAME)); SetKeyboardFocus(_R(IDC_EDITBRUSHNAME)); // change the dialog title to "Enter brush name:" String_256 Name = TEXT("Enter brush name:"); SetTitlebarName(&Name); if (resizeDialog) { // what we want to do is shrink the dialog by the size of the label and then hide it RECT LabelRect; GetGadgetPosition(_R(IDC_STATICBRUSHGROUP), &LabelRect); // hide the label HideGadget(_R(IDC_STATICBRUSHGROUP), TRUE); // get the size of this dialog RECT DialogRect; GetWindowPosition(&DialogRect); // subtract the size of the label INT32 Subtract = LabelRect.bottom - LabelRect.top; DialogRect.bottom -= Subtract; // We want to move up the buttons RECT OkRect; if (GetGadgetPosition(_R(IDOK), &OkRect)) { OkRect.top -= Subtract; OkRect.bottom -= Subtract; INT32 Width = OkRect.right - OkRect.left; Width = (Width * 2) / 3; OkRect.left += Width ; OkRect.right += Width; SetGadgetPosition(_R(IDOK), OkRect); } RECT CancelRect; if (GetGadgetPosition(_R(IDCANCEL), &CancelRect)) { CancelRect.top -= Subtract; CancelRect.bottom -= Subtract; INT32 Width = CancelRect.right - CancelRect.left; Width = (Width * 2) / 3; CancelRect.left += Width; CancelRect.right += Width; SetGadgetPosition(_R(IDCANCEL), CancelRect); } // Reset the window SetWindowPosition(DialogRect); // Hide the help button HideGadget(_R(ID_CC_HELP_BUTTON), TRUE); } }
MsgResult ToolnameDlg::Message(Msg* Message) { if (IS_OUR_DIALOG_MSG(Message)) { DialogMsg* Msg = (DialogMsg*)Message; BOOL EndDialog = FALSE; switch (Msg->DlgMsg) { case DIM_CREATE: SetKeyboardFocus (_R(IDC_EDITNEWBARNAME)) ; HighlightText (_R(IDC_EDITNEWBARNAME)) ; break ; case DIM_COMMIT: { // Accept all changes that the user wants to make to toolbars... BOOL VV; String_32 NewBarName = GetStringGadgetValue(_R(IDC_EDITNEWBARNAME),&VV); if(NewBarName.Length()==0) { UINT32 Number = DialogBarOp::FindUniqueBarNumber(); NewBarName._MakeMsg(TEXT("Bar #1%ld"),Number); } DialogBarOp* pNewBar = new DialogBarOp(NewBarName); if (pNewBar) { pNewBar->SetDockBarType(DOCKBAR_FLOAT); pNewBar->Create(); // The Create function sends a message which we intercept to update // the list of bars in the Toolbars... dialog. // this is very dangerous in fact it blows up.. // so I have removed it .. chris. /* if (pNewBar) { // Find toolbar dialog and close it... ToolbarDlg* pToolbarDlg = ToolbarDlg::GetToolbarDlg(); if (pToolbarDlg) { pToolbarDlg->Close(); pToolbarDlg->End(); } } */ ToolbarDlg* pToolbarDlg = ToolbarDlg::GetToolbarDlg(); pToolbarDlg->ShowToolbarList(); } EndDialog = TRUE; } break; case DIM_CANCEL: // Cancel all changes the user wants to make to toolbars... EndDialog = TRUE; break; // default: } if (EndDialog) // Dialog communication over { Close(); // Close the dialog End(); // Destroy dialog } // return (DLG_EAT_IF_HUNGRY(Msg)); } // return OK; // Pass everything on to the base-class . . . return DialogOp::Message(Message); }