BOOL CDlgKeyHomophone::OnInitDialog() { int colWidth = 100; // Spaltenbreite in Pixel CDialog::OnInitDialog(); m_ctrlEncodeUmlauts.SetCheck(FALSE); m_AlphabetBackup = theApp.TextOptions.getAlphabet(); LoadString(AfxGetInstanceHandle(),IDS_PARAM_HOMOPHONE,pc_str,STR_LAENGE_STRING_TABLE); CString HParam; if ( PasteKey( pc_str, HParam ) ) { UpdateData(true); int d = strlen("PARAMETER: "); m_BaseHomophones = (int)(HParam[d] - '0'); m_ctrlEncryptFormatCharacters.SetCheck((int)(HParam[d+2] - '0')); m_ctrlEncodeUmlauts.SetCheck((int)(HParam[d+4] - '0')); m_InputType = (int)(HParam[d+6] - '0'); m_NoOfHomophones = (int)atoi( HParam.GetBuffer(0) +(d+8) ); UpdateData(false); // TEXT int ReInitFlag = 0; if ( !m_InputType ) { int l_alphabetLength = theApp.TextOptions.getAlphabet().GetLength(); if (m_NoOfHomophones < l_alphabetLength) { UpdateData(); m_NoOfHomophones = l_alphabetLength; UpdateData(FALSE); } if ( m_ctrlEncryptFormatCharacters.GetCheck() ) { if ( 0 > theApp.TextOptions.getAlphabet().Find("\n", 0) ) theApp.TextOptions.refAlphabet().Insert(0, "\n"); if ( 0 > theApp.TextOptions.getAlphabet().Find("\t", 0) ) theApp.TextOptions.refAlphabet().Insert(0, "\t"); if ( 0 > theApp.TextOptions.getAlphabet().Find("\r", 0) ) theApp.TextOptions.refAlphabet().Insert(0, "\r"); ReInitFlag = 1; } else { int ndx; if ( 0 <= (ndx = theApp.TextOptions.getAlphabet().Find("\n", 0)) ) theApp.TextOptions.refAlphabet().Delete(ndx); if ( 0 <= (ndx = theApp.TextOptions.getAlphabet().Find("\t", 0)) ) theApp.TextOptions.refAlphabet().Delete(ndx); if ( 0 <= (ndx = theApp.TextOptions.getAlphabet().Find("\r", 0)) ) theApp.TextOptions.refAlphabet().Delete(ndx); } } if ( m_NoOfHomophones != HB.GetKeySize() ) { HB.Resize( m_NoOfHomophones ); UpdateData(); m_Bitlength = HB.LogKeySize( 2 ); UpdateData(FALSE); ReInitFlag = 1; } if ( ReInitFlag ) HB.Init_Data(); } m_listview.SetExtendedStyle( LVS_EX_FULLROWSELECT ); // LoadString(AfxGetInstanceHandle(),IDS_STRING_SIGN,pc_str,STR_LAENGE_STRING_TABLE); m_listview.InsertColumn(1,"Ord",LVCFMT_LEFT,colWidth-48,1); // Ordnung Zeichen LoadString(AfxGetInstanceHandle(),IDS_STRING_SIGN,pc_str,STR_LAENGE_STRING_TABLE); m_listview.InsertColumn(2,pc_str,LVCFMT_LEFT,colWidth-32,1); // Zeichen LoadString(AfxGetInstanceHandle(),IDS_STRING_COLUMN_FREQUENCY,pc_str,STR_LAENGE_STRING_TABLE); m_listview.InsertColumn(3,pc_str,LVCFMT_LEFT,colWidth-24,2); // Anzahl LoadString(AfxGetInstanceHandle(),IDS_STRING_QUANTITY,pc_str,STR_LAENGE_STRING_TABLE); m_listview.InsertColumn(4,pc_str,LVCFMT_LEFT,colWidth-8,3); // Verschlüsselung LoadString(AfxGetInstanceHandle(),IDS_STRING_LIST_OF_HOMOPHONES,pc_str,STR_LAENGE_STRING_TABLE); m_listview.InsertColumn(5,pc_str,LVCFMT_LEFT,colWidth+2000,4); // Verschlüsselung Init_ListBox(); LOGFONT LogFont; CFont *defaultFont=m_listview.GetFont(); // this->GetFont() sollte auch funktionieren defaultFont->GetLogFont(&LogFont); // Default Systemschrift ermitteln strncpy(LogFont.lfFaceName,"Courier",32); // Auf Courier umstellen m_Font.CreateFontIndirect(&LogFont); // Font initialisieren m_listview.SetFont(&m_Font); if ( DeactivateDecryptionButton ) m_ButtonDecryption.EnableWindow(FALSE); VERIFY(m_Paste.AutoLoad(IDC_BUTTON2,this)); // add tool tip to the paste button CString buttonPasteText; buttonPasteText.LoadString(IDS_STRING_PASTE_KEY_FROM_KEY_STORE); m_Paste.SetToolTipText(&buttonPasteText); if ( m_InputType == HOM_ENC_TXT ) { m_ctrlEncodeUmlauts.EnableWindow(); m_ctrlEncryptFormatCharacters.EnableWindow(); m_ctrlTextOptions.EnableWindow(); } else { m_ctrlTextOptions.EnableWindow(FALSE); m_ctrlEncodeUmlauts.EnableWindow(FALSE); m_ctrlEncryptFormatCharacters.EnableWindow(FALSE); } CString SKeyID; SKeyID.LoadStringA(IDS_CRYPT_HOMOPHONE); if ( IsKeyEmpty( SKeyID ) ) { m_Paste.EnableWindow(TRUE); } else { m_Paste.EnableWindow(FALSE); } return(TRUE); }
void CDlgKeyHomophone::OnLoadKey() { SHOW_HOUR_GLASS UpdateData(TRUE); CString SKeyID; SKeyID.LoadStringA(IDS_CRYPT_HOMOPHONE); if ( FALSE == PasteKey(SKeyID, m_KeyCStr ) ) { m_KeyCtrl.SetSel(0,-1); m_KeyCtrl.Paste(); m_KeyCtrl.GetWindowText(m_KeyCStr); } HB.load_enc_table(m_KeyCStr.GetBuffer(16000)); m_NoOfHomophones = HB.GetKeySize(); m_Bitlength = HB.LogKeySize( 2 ); m_listview.DeleteAllItems(); m_InputType = HB.GetKeyType(); LoadListBox(); int Flag = 0; CString newAlphabet = _T(""); for(int i=0;i<range;i++) { if(HB.GetEncryptionData1(i)>0) { if ( char(i) == '\n' || char(i) == '\t' || char(i) == '\r' ) { Flag |= 1; } newAlphabet += char(i); if ( 0 > theApp.TextOptions.getAlphabet().Find(char(i)) ) { Flag |= 2; } } } if ( (HOM_ENC_TXT == m_InputType) && (Flag & 1) ) m_ctrlEncryptFormatCharacters.SetCheck(1); if ( (HOM_ENC_TXT == m_InputType) && (Flag & 2 || newAlphabet.GetLength() != theApp.TextOptions.getAlphabet().GetLength()) ) { Message( IDS_MSG_HOMOPHONE_CHANGE_OF_ALPHABET, MB_ICONINFORMATION, theApp.TextOptions.getAlphabet(), newAlphabet ); theApp.TextOptions.refAlphabet() = newAlphabet; } if ( m_InputType == HOM_ENC_TXT ) { m_ctrlEncodeUmlauts.EnableWindow(); m_ctrlEncryptFormatCharacters.EnableWindow(); } else { m_ctrlEncodeUmlauts.EnableWindow(FALSE); m_ctrlEncryptFormatCharacters.EnableWindow(FALSE); } // === Reset selected homophonic list m_EditNoOfHomophones = 0; m_RowHomophonesList = _T(""); m_HomophonesList = _T(""); UpdateData(FALSE); HIDE_HOUR_GLASS }
QString MenuCommands::Get(int ind, What w) const { int cur = 0; if (cur++ == ind) return (w == Key ? FileKey() : (w == Title? FileTitle() : "")); if (cur++ == ind) return (w == Key ? NewWinKey() : (w == Title? NewWinTitle() : GetStr(NewWinShortcuts()))); if (cur++ == ind) return (w == Key ? OpenFileKey() : (w == Title? OpenFileTitle() : GetStr(OpenFileShortcuts()))); if (cur++ == ind) return (w == Key ? OpenLocKey() : (w == Title? OpenLocTitle() : GetStr(OpenLocShortcuts()))); if (cur++ == ind) return (w == Key ? SaveAsKey() : (w == Title? SaveAsTitle() : GetStr(SaveAsShortcuts()))); if (cur++ == ind) return (w == Key ? SavePdfKey() : (w == Title? SavePdfTitle() : GetStr(SavePdfShortcuts()))); if (cur++ == ind) return (w == Key ? ImportKey() : (w == Title? ImportTitle() : "")); if (cur++ == ind) return (w == Key ? ImportIEKey() : (w == Title? ImportIETitle() : GetStr(ImportIEShortcuts()))); if (cur++ == ind) return (w == Key ? ImportFFKey() : (w == Title? ImportFFTitle() : GetStr(ImportFFShortcuts()))); if (cur++ == ind) return (w == Key ? ImportHtmlKey() : (w == Title? ImportHtmlTitle() : GetStr(ImportHtmlShortcuts()))); if (cur++ == ind) return (w == Key ? ImportXmlKey() : (w == Title? ImportXmlTitle() : GetStr(ImportXmlShortcuts()))); if (cur++ == ind) return (w == Key ? ExportKey() : (w == Title? ExportTitle() : GetStr(ExportShortcuts()))); if (cur++ == ind) return (w == Key ? PrintKey() : (w == Title? PrintTitle() : GetStr(PrintShortcuts()))); if (cur++ == ind) return (w == Key ? PreviewKey() : (w == Title? PreviewTitle() : GetStr(PreviewShortcuts()))); if (cur++ == ind) return (w == Key ? QuitKey() : (w == Title? QuitTitle() : GetStr(QuitShortcuts()))); if (cur++ == ind) return (w == Key ? EditKey() : (w == Title? EditTitle() : "")); if (cur++ == ind) return (w == Key ? UndoKey() : (w == Title? UndoTitle() : GetStr(UndoShortcuts()))); if (cur++ == ind) return (w == Key ? RedoKey() : (w == Title? RedoTitle() : GetStr(RedoShortcuts()))); if (cur++ == ind) return (w == Key ? CutKey() : (w == Title? CutTitle() : GetStr(CutShortcuts()))); if (cur++ == ind) return (w == Key ? CopyKey() : (w == Title? CopyTitle() : GetStr(CopyShortcuts()))); if (cur++ == ind) return (w == Key ? PasteKey() : (w == Title? PasteTitle() : GetStr(PasteShortcuts()))); if (cur++ == ind) return (w == Key ? FindKey() : (w == Title? FindTitle() : GetStr(FindShortcuts()))); if (cur++ == ind) return (w == Key ? NextKey() : (w == Title? NextTitle() : GetStr(NextShortcuts()))); if (cur++ == ind) return (w == Key ? PrevKey() : (w == Title? PrevTitle() : GetStr(PrevShortcuts()))); if (cur++ == ind) return (w == Key ? PrefsKey() : (w == Title? PrefsTitle() : GetStr(PrefsShortcuts()))); if (cur++ == ind) return (w == Key ? ViewKey() : (w == Title? ViewTitle() : "")); if (cur++ == ind) return (w == Key ? AppStylesKey() : (w == Title? AppStylesTitle() : "")); if (cur++ == ind) return (w == Key ? StatusKey() : (w == Title? StatusTitle() : GetStr(StatusShortcuts()))); if (cur++ == ind) return (w == Key ? MenuKey() : (w == Title? MenuTitle() : GetStr(MenuShortcuts()))); if (cur++ == ind) return (w == Key ? TabKey() : (w == Title? TabTitle() : GetStr(TabShortcuts()))); if (cur++ == ind) return (w == Key ? NavKey() : (w == Title? NavTitle() : GetStr(NavShortcuts()))); if (cur++ == ind) return (w == Key ? BooksKey() : (w == Title? BooksTitle() : GetStr(BooksShortcuts()))); // if (cur++ == ind) // return (w == Key ? Key() : (w == Title? Title() : GetStr(Shortcuts()))); if (cur++ == ind) return (w == Key ? StopKey() : (w == Title? StopTitle() : GetStr(StopShortcuts()))); if (cur++ == ind) return (w == Key ? ReloadKey() : (w == Title? ReloadTitle() : GetStr(ReloadShortcuts()))); if (cur++ == ind) return (w == Key ? LargerKey() : (w == Title? LargerTitle() : GetStr(LargerShortcuts()))); if (cur++ == ind) return (w == Key ? NormalKey() : (w == Title? NormalTitle() : GetStr(NormalShortcuts()))); if (cur++ == ind) return (w == Key ? SmallerKey() : (w == Title? SmallerTitle() : GetStr(SmallerShortcuts()))); if (cur++ == ind) return (w == Key ? TextOnlyKey() : (w == Title? TextOnlyTitle() : GetStr(TextOnlyShortcuts()))); if (cur++ == ind) return (w == Key ? EncodeKey() : (w == Title? EncodeTitle() : "")); if (cur++ == ind) return (w == Key ? SourceKey() : (w == Title? SourceTitle() : GetStr(SourceShortcuts()))); if (cur++ == ind) return (w == Key ? FullKey() : (w == Title? FullTitle() : GetStr(FullShortcuts()))); if (cur++ == ind) return (w == Key ? HistoryKey() : (w == Title? HistoryTitle() : "")); if (cur++ == ind) return (w == Key ? BackKey() : (w == Title? BackTitle() : GetStr(BackShortcuts()))); if (cur++ == ind) return (w == Key ? ForwKey() : (w == Title? ForwTitle() : GetStr(ForwShortcuts()))); if (cur++ == ind) return (w == Key ? HomeKey() : (w == Title? HomeTitle() : GetStr(HomeShortcuts()))); if (cur++ == ind) return (w == Key ? LastTabKey() : (w == Title? LastTabTitle() : GetStr(LastTabShortcuts()))); if (cur++ == ind) return (w == Key ? LastTabsKey() : (w == Title? LastTabsTitle() : GetStr(LastTabsShortcuts()))); if (cur++ == ind) return (w == Key ? SessionKey() : (w == Title? SessionTitle() : GetStr(SessionShortcuts()))); if (cur++ == ind) return (w == Key ? AllHistKey() : (w == Title? AllHistTitle() : GetStr(AllHistShortcuts()))); if (cur++ == ind) return (w == Key ? ClearKey() : (w == Title? ClearTitle() : GetStr(ClearShortcuts()))); if (cur++ == ind) return (w == Key ? BookmarksKey() : (w == Title? BookmarksTitle() : "")); if (cur++ == ind) return (w == Key ? AllBooksKey() : (w == Title? AllBooksTitle() : GetStr(AllBooksShortcuts()))); if (cur++ == ind) return (w == Key ? AddBookKey() : (w == Title? AddBookTitle() : GetStr(AddBookShortcuts()))); if (cur++ == ind) return (w == Key ? PrivacyKey() : (w == Title? PrivacyTitle() : "")); if (cur++ == ind) return (w == Key ? PrivateKey() : (w == Title? PrivateTitle() : GetStr(PrivateShortcuts()))); if (cur++ == ind) return (w == Key ? JavaScriptKey() : (w == Title? JavaScriptTitle() : GetStr(JavaScriptShortcuts()))); if (cur++ == ind) return (w == Key ? ImagesKey() : (w == Title? ImagesTitle() : GetStr(ImagesShortcuts()))); if (cur++ == ind) return (w == Key ? CookiesKey() : (w == Title? CookiesTitle() : GetStr(CookiesShortcuts()))); if (cur++ == ind) return (w == Key ? PlugInsKey() : (w == Title? PlugInsTitle() : GetStr(PlugInsShortcuts()))); if (cur++ == ind) return (w == Key ? AgentKey() : (w == Title? AgentTitle() : GetStr(AgentShortcuts()))); if (cur++ == ind) return (w == Key ? PopUpsKey() : (w == Title? PopUpsTitle() : GetStr(PopUpsShortcuts()))); if (cur++ == ind) return (w == Key ? ProxyKey() : (w == Title? ProxyTitle() : GetStr(ProxyShortcuts()))); if (cur++ == ind) return (w == Key ? EmptyKey() : (w == Title? EmptyTitle() : GetStr(EmptyShortcuts()))); if (cur++ == ind) return (w == Key ? ResetKey() : (w == Title? ResetTitle() : GetStr(ResetShortcuts()))); if (cur++ == ind) return (w == Key ? FullResetKey() : (w == Title? FullResetTitle() : GetStr(FullResetShortcuts()))); if (cur++ == ind) return (w == Key ? ToolsKey() : (w == Title? ToolsTitle() : "")); if (cur++ == ind) return (w == Key ? CompatKey() : (w == Title? CompatTitle() : "")); if (cur++ == ind) return (w == Key ? SearchKey() : (w == Title? SearchTitle() : GetStr(SearchShortcuts()))); if (cur++ == ind) return (w == Key ? KeyboardKey() : (w == Title? KeyboardTitle() : GetStr(KeyboardShortcuts()))); if (cur++ == ind) return (w == Key ? InspectorKey() : (w == Title? InspectorTitle() : GetStr(InspectorShortcuts()))); if (cur++ == ind) return (w == Key ? InspectKey() : (w == Title? InspectTitle() : GetStr(InspectShortcuts()))); if (cur++ == ind) return (w == Key ? OptionsKey() : (w == Title? OptionsTitle() : GetStr(OptionsShortcuts()))); if (cur++ == ind) return (w == Key ? WindowKey() : (w == Title? WindowTitle() : "")); if (cur++ == ind) return (w == Key ? NextTabKey() : (w == Title? NextTabTitle() : GetStr(NextTabShortcuts()))); if (cur++ == ind) return (w == Key ? PrevTabKey() : (w == Title? PrevTabTitle() : GetStr(PrevTabShortcuts()))); if (cur++ == ind) return (w == Key ? NewTabKey() : (w == Title? NewTabTitle() : GetStr(NewTabShortcuts()))); if (cur++ == ind) return (w == Key ? CloseTabKey() : (w == Title? CloseTabTitle() : GetStr(CloseTabShortcuts()))); if (cur++ == ind) return (w == Key ? CloseOtherKey() : (w == Title? CloseOtherTitle() : GetStr(CloseOtherShortcuts()))); if (cur++ == ind) return (w == Key ? CloneTabKey() : (w == Title? CloneTabTitle() : GetStr(CloneTabShortcuts()))); if (cur++ == ind) return (w == Key ? ReloadTabKey() : (w == Title? ReloadTabTitle() : GetStr(ReloadTabShortcuts()))); if (cur++ == ind) return (w == Key ? ReloadAllKey() : (w == Title? ReloadAllTitle() : GetStr(ReloadAllShortcuts()))); if (cur++ == ind) return (w == Key ? OpenNewTabKey() : (w == Title? OpenNewTabTitle() : GetStr(OpenNewTabShortcuts()))); if (cur++ == ind) return (w == Key ? OpenAdBlockKey() : (w == Title? OpenAdBlockTitle() : GetStr(OpenAdBlockShortcuts()))); if (cur++ == ind) return (w == Key ? SwapFocusKey() : (w == Title? SwapFocusTitle() : GetStr(SwapFocusShortcuts()))); if (cur++ == ind) return (w == Key ? CopyAddrKey() : (w == Title? CopyAddrTitle() : "")); if (cur++ == ind) return (w == Key ? DownsKey() : (w == Title? DownsTitle() : GetStr(DownsShortcuts()))); if (cur++ == ind) return (w == Key ? TorrentsKey() : (w == Title? TorrentsTitle() : GetStr(TorrentsShortcuts()))); if (cur++ == ind) return (w == Key ? HelpKey() : (w == Title? HelpTitle() : GetStr(HelpShortcuts()))); if (cur++ == ind) return (w == Key ? OnlineKey() : (w == Title? OnlineTitle() : GetStr(OnlineShortcuts()))); if (cur++ == ind) return (w == Key ? UpdatesKey() : (w == Title? UpdatesTitle() : GetStr(UpdatesShortcuts()))); if (cur++ == ind) return (w == Key ? AboutKey() : (w == Title? AboutTitle() : GetStr(AboutShortcuts()))); return ""; }