void BookmarksManagerDialog::SuggestSaving (QObject *entryObj) { const auto entry = qobject_cast<ICLEntry*> (entryObj); if (!entry) { qWarning () << Q_FUNC_INFO << "object doesn't implement ICLEntry" << entryObj; return; } const bool found = FocusOn (entry->GetParentAccount ()); if (!found) { qWarning () << Q_FUNC_INFO << "unable to find parent protocol for entry" << entryObj << entry->GetEntryID (); return; } const auto& data = GetIdentifyingData (entryObj); if (data.isEmpty ()) { qWarning () << Q_FUNC_INFO << "empty identifying data returned by" << entryObj; return; } AddBookmark (data); }
BOOL CScintillaBibWnd::MarkMatches(LPCSTR lpText) { if (lpText == NULL) return FALSE; ClearBookmarks(); DWORD matches = 0; m_nSearchflags = 0; if (m_WholeWords) m_nSearchflags |= SCFIND_WHOLEWORD; if (m_MatchCase) m_nSearchflags |= SCFIND_MATCHCASE; if (m_RegExpr) m_nSearchflags |= SCFIND_REGEXP; TextToFind tf; int lPos = -1; char* txt = new char[strlen(lpText)+1]; strcpy(txt, lpText); tf.lpstrText = txt; tf.chrg.cpMax = SendMessage(SCI_GETLENGTH, 0, 0); do { tf.chrg.cpMin = lPos+1; lPos = SendMessage(SCI_FINDTEXT, m_nSearchflags, (long)&tf); if (lPos > -1) { int l = SendMessage(SCI_LINEFROMPOSITION, lPos, 0) + 1; AddBookmark(l); matches++; } } while (lPos > -1); delete [] txt; return matches; }
void Dlg_MemBookmark::ImportFromFile( std::string sFilename ) { FILE* pFile = nullptr; errno_t nErr = fopen_s( &pFile, sFilename.c_str(), "r" ); if ( pFile != nullptr ) { Document doc; doc.ParseStream( FileStream( pFile ) ); if ( !doc.HasParseError() ) { if ( doc.HasMember( "Bookmarks" ) ) { ClearAllBookmarks(); const Value& BookmarksData = doc[ "Bookmarks" ]; for ( SizeType i = 0; i < BookmarksData.Size(); ++i ) { MemBookmark* NewBookmark = new MemBookmark(); wchar_t buffer[ 256 ]; swprintf_s ( buffer, 256, L"%s", Widen( BookmarksData[ i ][ "Description" ].GetString() ).c_str() ); NewBookmark->SetDescription ( buffer ); NewBookmark->SetAddress( BookmarksData[ i ][ "Address" ].GetUint() ); NewBookmark->SetType( BookmarksData[ i ][ "Type" ].GetInt() ); NewBookmark->SetDecimal( BookmarksData[ i ][ "Decimal" ].GetBool() ); NewBookmark->SetValue( GetMemory( NewBookmark->Address(), NewBookmark->Type() ) ); NewBookmark->SetPrevious ( NewBookmark->Value() ); AddBookmark ( NewBookmark ); AddBookmarkMap( NewBookmark ); } if ( m_vBookmarks.size() > 0 ) PopulateList(); } else { ASSERT ( " !Invalid Bookmark File..." ); MessageBox( nullptr, _T("Could not load properly. Invalid Bookmark file."), _T("Error"), MB_OK | MB_ICONERROR ); return; } } fclose( pFile ); } }
size_t BookmarkManager::MoveBookmarkInMemory(size_t bmIndex, size_t curCatIndex, size_t newCatIndex) { BookmarkData data; m2::PointD ptOrg; // guard must be released before AddBookmark to prevent deadlock { BookmarkCategory * cat = m_framework.GetBmCategory(curCatIndex); BookmarkCategory::Guard guard(*cat); Bookmark const * bm = static_cast<Bookmark const *>(guard.m_controller.GetUserMark(bmIndex)); data = bm->GetData(); ptOrg = bm->GetPivot(); guard.m_controller.DeleteUserMark(bmIndex); } return AddBookmark(newCatIndex, ptOrg, data); }
void Dlg_MemBookmark::AddAddress() { if ( g_pCurrentGameData->GetGameID() == 0 ) return; MemBookmark* NewBookmark = new MemBookmark(); // Fetch Memory Address from Memory Inspector TCHAR buffer[ 256 ]; GetDlgItemText( g_MemoryDialog.GetHWND(), IDC_RA_WATCHING, buffer, 256 ); unsigned int nAddr = strtol( Narrow( buffer ).c_str(), nullptr, 16 ); NewBookmark->SetAddress( nAddr ); // Check Data Type if ( SendDlgItemMessage( g_MemoryDialog.GetHWND(), IDC_RA_MEMVIEW8BIT, BM_GETCHECK, 0, 0 ) == BST_CHECKED ) NewBookmark->SetType( 1 ); else if ( SendDlgItemMessage( g_MemoryDialog.GetHWND(), IDC_RA_MEMVIEW16BIT, BM_GETCHECK, 0, 0 ) == BST_CHECKED ) NewBookmark->SetType( 2 ); else NewBookmark->SetType( 3 ); // Get Memory Value NewBookmark->SetValue( GetMemory( nAddr, NewBookmark->Type() ) ); NewBookmark->SetPrevious( NewBookmark->Value() ); // Get Code Note and add as description const CodeNotes::CodeNoteObj* pSavedNote = g_MemoryDialog.Notes().FindCodeNote( nAddr ); if ( ( pSavedNote != nullptr ) && ( pSavedNote->Note().length() > 0 ) ) NewBookmark->SetDescription( Widen( pSavedNote->Note() ).c_str() ); // Add Bookmark to vector and map AddBookmark( NewBookmark ); AddBookmarkMap( NewBookmark ); PopulateList(); }
void BookmarksManagerDialog::on_AddButton__released () { AddBookmark ({}); }
static Boolean MainFormMenuCommand(AppContext* appContext, FormType* form, EventType* event) { Boolean handled=false; switch (event->data.menu.itemID) { case menuItemAbout: MainFormHandleAbout(appContext); handled=true; break; case menuItemCopy: MainFormHandleCopy(appContext); handled=true; break; case menuItemLookupClipboard: MainFormLookupClipboard(appContext); handled=true; break; case menuItemRandomWord: LookupRandomWord(appContext); handled=true; break; case menuItemRecentLookups: MainFormHandleRecentLookups(appContext); handled=true; break; case menuItemPrefs: FrmPopupForm(formPrefs); handled=true; break; case menuItemDispPrefs: FrmPopupForm(formDisplayPrefs); handled=true; break; case menuItemRegister: #ifdef UNLOCKED FrmAlert(alreadyRegisteredAlert); #else MainFormHandleRegister(appContext,false); #endif FrmUpdateForm(formDictMain, redrawAll); handled=true; break; case menuItemBookmarkView: if (GetBookmarksCount(appContext)>0) FrmPopupForm(formBookmarks); else FrmAlert(alertNoBookmarks); handled=true; break; case menuItemBookmarkWord: if (ebufGetDataSize(&appContext->currentWordBuf)) AddBookmark(appContext, ebufGetDataPointer(&appContext->currentWordBuf)); handled=true; break; case menuItemBookmarkDelete: if (ebufGetDataSize(&appContext->currentWordBuf)) DeleteBookmark(appContext, ebufGetDataPointer(&appContext->currentWordBuf)); handled=true; break; case menuItemGotoWebsite: //if ( errNone != ErrWebBrowserCommand(false, 0, sysAppLaunchCmdGoToURL, "http://arslexis.local.org:4080/pda/palm.html",NULL) ) if ( errNone != ErrWebBrowserCommand(false, 0, sysAppLaunchCmdGoToURL, "http://www.arslexis.com/pda/palm.html",NULL) ) FrmAlert(alertNoWebBrowser); handled=true; break; case menuItemCheckUpdates: //if ( errNone != ErrWebBrowserCommand(false, 0, sysAppLaunchCmdGoToURL, "http://arslexis.local.org:4080/updates/palm-inoah-1-0.html",NULL) ) if ( errNone != ErrWebBrowserCommand(false, 0, sysAppLaunchCmdGoToURL, "http://www.arslexis.com/updates/palm-inoah-1-1.html",NULL) ) FrmAlert(alertNoWebBrowser); handled=true; break; case forwardMenuItem: DoForward(appContext); handled=true; break; case backMenuItem: DoBack(appContext); handled=true; break; #ifdef DEBUG case menuItemStress: appContext->fInStress = true; LookupRandomWord(appContext); handled=true; break; #endif case sysEditMenuCopyCmd: case sysEditMenuCutCmd: case sysEditMenuPasteCmd: // generated by command bar, not sure what to do with those // so just ignore them handled = false; break; default: Assert(false); } return handled; }