Make (de)composition a separate translation set

This commit is contained in:
Simon Rozman 2018-09-17 15:06:51 +02:00
parent 30b2eb270b
commit 5e751eb23e
18 changed files with 3904 additions and 182 deletions

Binary file not shown.

View File

@ -183,7 +183,7 @@
<None Include="res\send_composed.ico" />
<None Include="res\send_decomposed.ico" />
<None Include="res\zrcola.ico" />
<None Include="ZRCola.fbp">
<None Include="res\ZRCola.fbp">
<SubType>Designer</SubType>
</None>
</ItemGroup>
@ -195,6 +195,9 @@
<POCompile Include="locale\ru_RU.po" />
<POCompile Include="locale\sl_SI.po" />
</ItemGroup>
<ItemGroup>
<Image Include="res\composition.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\include\xgettext.targets" />

View File

@ -128,7 +128,7 @@
<None Include="res\edit_paste.ico">
<Filter>Resource Files</Filter>
</None>
<None Include="ZRCola.fbp">
<None Include="res\ZRCola.fbp">
<Filter>Resource Files</Filter>
</None>
<None Include="res\char_select.ico">
@ -166,4 +166,9 @@
<Filter>Resource Files\Localization</Filter>
</POCompile>
</ItemGroup>
<ItemGroup>
<Image Include="res\composition.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>

View File

@ -235,7 +235,7 @@
<property name="id">wxID_SELECTALL</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Select &amp;All</property>
<property name="name">m_menuSelectAll</property>
<property name="name">m_menuItemSelectAll</property>
<property name="permission">none</property>
<property name="shortcut">Ctrl+A</property>
<property name="unchecked_bitmap"></property>
@ -254,7 +254,7 @@
<property name="id">wxID_CHARACTER_SELECTOR</property>
<property name="kind">wxITEM_NORMAL</property>
<property name="label">Find C&amp;haracter...</property>
<property name="name">m_menuCharSelect</property>
<property name="name">m_menuItemCharSelect</property>
<property name="permission">none</property>
<property name="shortcut">F8</property>
<property name="unchecked_bitmap"></property>
@ -344,6 +344,31 @@
<property name="name">separator4</property>
<property name="permission">none</property>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
<property name="checked">0</property>
<property name="enabled">1</property>
<property name="help">Toggle ZRCola character (De)composition</property>
<property name="id">wxID_COMPOSITION_MENU</property>
<property name="kind">wxITEM_CHECK</property>
<property name="label">&amp;ZRCola (De)composition</property>
<property name="name">m_menuItemComposition</property>
<property name="permission">protected</property>
<property name="shortcut"></property>
<property name="unchecked_bitmap"></property>
<event name="OnMenuSelection"></event>
<event name="OnUpdateUI"></event>
</object>
<object class="submenu" expanded="0">
<property name="bitmap"></property>
<property name="label">Tra&amp;nslation</property>
<property name="name">m_menuTranslationSeq</property>
<property name="permission">protected</property>
</object>
<object class="separator" expanded="0">
<property name="name">separator5</property>
<property name="permission">none</property>
</object>
<object class="wxMenuItem" expanded="0">
<property name="bitmap"></property>
<property name="checked">0</property>
@ -808,6 +833,27 @@
<event name="OnToolRClicked"></event>
<event name="OnUpdateUI"></event>
</object>
<object class="tool" expanded="0">
<property name="bitmap">Load From Icon Resource; composition.ico; [24; 24]</property>
<property name="context_menu">0</property>
<property name="id">wxID_COMPOSITION_TOOLBAR</property>
<property name="kind">wxITEM_CHECK</property>
<property name="label">ZRCola (De)composition</property>
<property name="name">m_toolComposition</property>
<property name="permission">protected</property>
<property name="statusbar">Toggle ZRCola character (De)composition</property>
<property name="tooltip">ZRCola (De)composition</property>
<event name="OnAuiToolBarBeginDrag"></event>
<event name="OnAuiToolBarMiddleClick"></event>
<event name="OnAuiToolBarOverflowClick"></event>
<event name="OnAuiToolBarRightClick"></event>
<event name="OnAuiToolBarToolDropDown"></event>
<event name="OnMenuSelection"></event>
<event name="OnToolClicked"></event>
<event name="OnToolEnter"></event>
<event name="OnToolRClicked"></event>
<event name="OnUpdateUI"></event>
</object>
<object class="wxChoice" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>

BIN
ZRCola/res/composition.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

1960
ZRCola/res/composition.pdf Normal file

File diff suppressed because one or more lines are too long

1243
ZRCola/res/zrcolagui.cpp Normal file

File diff suppressed because it is too large Load Diff

418
ZRCola/res/zrcolagui.h Normal file
View File

@ -0,0 +1,418 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 8 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __ZRCOLAGUI_H__
#define __ZRCOLAGUI_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/cshelp.h>
#include <wx/intl.h>
class wxZRColaCharGrid;
#include <wx/string.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/menu.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/aui/aui.h>
#include <wx/aui/auibar.h>
#include <wx/choice.h>
class wxZRColaCharacterCatalogPanel;
class wxZRColaComposerPanel;
#include <wx/statusbr.h>
#include <wx/frame.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/panel.h>
#include <wx/splitter.h>
#include <wx/timer.h>
#include <wx/grid.h>
#include <wx/checkbox.h>
#include <wx/srchctrl.h>
#include <wx/hyperlink.h>
#include <wx/checklst.h>
#include <wx/stattext.h>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/radiobut.h>
#include <wx/listbox.h>
#include <wx/listbook.h>
#include <wx/listctrl.h>
#include <wx/statbmp.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class wxZRColaFrameBase
///////////////////////////////////////////////////////////////////////////////
class wxZRColaFrameBase : public wxFrame
{
private:
protected:
enum
{
wxID_CHARACTER_SELECTOR = 1000,
wxID_SEND_DESTINATION,
wxID_COPY_DESTINATION_AND_RETURN,
wxID_SEND_SOURCE,
wxID_COPY_SOURCE_AND_RETURN,
wxID_SEND_ABORT,
wxID_COMPOSITION_MENU,
wxID_SETTINGS,
wxID_TOOLBAR_EDIT,
wxID_TOOLBAR_TRANSLATE,
wxID_PANEL_CHRGRPS,
wxID_HELP_INSTRUCTIONS,
wxID_HELP_SHORTCUTS,
wxID_HELP_REQCHAR,
wxID_HELP_UPDATE,
wxID_COMPOSITION_TOOLBAR
};
wxMenuBar* m_menubar;
wxMenu* m_menuProgram;
wxMenu* m_menuEdit;
wxMenuItem* m_menuItemComposition;
wxMenu* m_menuTranslationSeq;
wxMenu* m_menuView;
wxMenu* m_menuHelp;
wxAuiToolBar* m_toolbarEdit;
wxAuiToolBarItem* m_toolEditCut;
wxAuiToolBarItem* m_toolEditCopy;
wxAuiToolBarItem* m_toolEditPaste;
wxAuiToolBar* m_toolbarTranslate;
wxAuiToolBarItem* m_toolCharSelect;
wxAuiToolBarItem* m_toolSendDestination;
wxAuiToolBarItem* m_toolSendSource;
wxAuiToolBarItem* m_toolComposition;
wxChoice* m_toolTranslationSeq;
wxZRColaCharacterCatalogPanel* m_panelChrCat;
wxStatusBar* m_statusBar;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnIconize( wxIconizeEvent& event ) { event.Skip(); }
virtual void OnIdle( wxIdleEvent& event ) { event.Skip(); }
virtual void OnTranslationSeqChoice( wxCommandEvent& event ) { event.Skip(); }
public:
wxZRColaComposerPanel* m_panel;
wxZRColaFrameBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("ZRCola"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 600,400 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL, const wxString& name = wxT("ZRCola") );
wxAuiManager m_mgr;
~wxZRColaFrameBase();
};
///////////////////////////////////////////////////////////////////////////////
/// Class wxZRColaComposerPanelBase
///////////////////////////////////////////////////////////////////////////////
class wxZRColaComposerPanelBase : public wxPanel
{
private:
protected:
enum
{
wxID_TIMER_SAVE = 1000
};
wxSplitterWindow* m_splitterSource;
wxPanel* m_panelSourceEdit;
wxPanel* m_panelSourceHex;
wxTextCtrl* m_sourceHex;
wxSplitterWindow* m_splitterDestination;
wxPanel* m_panelDestinationEdit;
wxPanel* m_panelDestinationHex;
wxTextCtrl* m_destinationHex;
wxTimer m_timerSave;
// Virtual event handlers, overide them in your derived class
virtual void OnSourcePaint( wxPaintEvent& event ) { event.Skip(); }
virtual void OnSourceText( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSourceHexPaint( wxPaintEvent& event ) { event.Skip(); }
virtual void OnDestinationPaint( wxPaintEvent& event ) { event.Skip(); }
virtual void OnDestinationText( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDestinationHexPaint( wxPaintEvent& event ) { event.Skip(); }
virtual void OnSaveTimer( wxTimerEvent& event ) { event.Skip(); }
public:
wxTextCtrl* m_source;
wxTextCtrl* m_destination;
wxZRColaComposerPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxT("ZRColaComposerPanel") );
~wxZRColaComposerPanelBase();
void m_splitterSourceOnIdle( wxIdleEvent& )
{
m_splitterSource->SetSashPosition( -5 );
m_splitterSource->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaComposerPanelBase::m_splitterSourceOnIdle ), NULL, this );
}
void m_splitterDestinationOnIdle( wxIdleEvent& )
{
m_splitterDestination->SetSashPosition( -5 );
m_splitterDestination->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxZRColaComposerPanelBase::m_splitterDestinationOnIdle ), NULL, this );
}
};
///////////////////////////////////////////////////////////////////////////////
/// Class wxZRColaCharacterCatalogPanelBase
///////////////////////////////////////////////////////////////////////////////
class wxZRColaCharacterCatalogPanelBase : public wxPanel
{
private:
protected:
wxChoice* m_choice;
wxZRColaCharGrid* m_grid;
wxCheckBox* m_show_all;
// Virtual event handlers, overide them in your derived class
virtual void OnChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void OnGridClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnGridKeyDown( wxKeyEvent& event ) { event.Skip(); }
virtual void OnShowAll( wxCommandEvent& event ) { event.Skip(); }
public:
wxZRColaCharacterCatalogPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxT("ZRColaCharacterCatalog") );
~wxZRColaCharacterCatalogPanelBase();
};
///////////////////////////////////////////////////////////////////////////////
/// Class wxZRColaCharSelectBase
///////////////////////////////////////////////////////////////////////////////
class wxZRColaCharSelectBase : public wxDialog
{
private:
protected:
wxSearchCtrl* m_search;
wxHyperlinkCtrl* m_search_more;
wxPanel* m_search_panel;
wxCheckListBox* m_categories;
wxHyperlinkCtrl* m_categoriesAll;
wxHyperlinkCtrl* m_categoriesNone;
wxHyperlinkCtrl* m_categoriesInvert;
wxZRColaCharGrid* m_gridResults;
wxZRColaCharGrid* m_gridRecent;
wxStaticText* m_labelUnicode;
wxTextCtrl* m_unicode;
wxTextCtrl* m_shortcut;
wxGrid* m_gridPreview;
wxTextCtrl* m_description;
wxTextCtrl* m_tags;
wxTextCtrl* m_category;
wxHyperlinkCtrl* m_navigateBack;
wxHyperlinkCtrl* m_navigateForward;
wxZRColaCharGrid* m_gridRelated;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnIdle( wxIdleEvent& event ) { event.Skip(); }
virtual void OnSearchText( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSearchMore( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void OnCategoriesToggle( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCategoriesAll( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void OnCategoriesNone( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void OnCategoriesInvert( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void OnResultCellDClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnResultSelectCell( wxGridEvent& event ) { event.Skip(); }
virtual void OnResultsKeyDown( wxKeyEvent& event ) { event.Skip(); }
virtual void OnRecentCellDClick( wxGridEvent& event ) { event.Skip(); }
virtual void OnRecentSelectCell( wxGridEvent& event ) { event.Skip(); }
virtual void OnRecentKeyDown( wxKeyEvent& event ) { event.Skip(); }
virtual void OnUnicodeText( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPreviewKeyDown( wxKeyEvent& event ) { event.Skip(); }
virtual void OnNavigateBack( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void OnNavigateForward( wxHyperlinkEvent& event ) { event.Skip(); }
virtual void OnRelatedSelectCell( wxGridEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
wxZRColaCharSelectBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Character Search"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("ZRColaCharSelect") );
~wxZRColaCharSelectBase();
};
///////////////////////////////////////////////////////////////////////////////
/// Class wxZRColaSettingsBase
///////////////////////////////////////////////////////////////////////////////
class wxZRColaSettingsBase : public wxDialog
{
private:
protected:
wxListbook* m_listbook;
wxPanel* m_panelLanguage;
wxStaticText* m_langLabel;
wxRadioButton* m_langAuto;
wxRadioButton* m_langManual;
wxListBox* m_languages;
wxPanel* m_panelAutoStart;
wxStaticText* m_autoStartLabel;
wxCheckBox* m_autoStart;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsApply;
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnLanguageUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnApplyButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
wxZRColaSettingsBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("ZRColaSettings") );
~wxZRColaSettingsBase();
};
///////////////////////////////////////////////////////////////////////////////
/// Class wxZRColaAboutBase
///////////////////////////////////////////////////////////////////////////////
class wxZRColaAboutBase : public wxDialog
{
private:
protected:
wxStaticBitmap* m_bitmapIcon;
wxStaticText* m_staticTextZRCola;
wxStaticText* m_staticTextVersion;
wxStaticText* m_staticTextColophone;
wxStaticText* m_staticTextCopyright;
wxHyperlinkCtrl* m_hyperlink;
wxStaticText* m_staticTextDeclaration;
wxTextCtrl* m_declaration;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
public:
wxZRColaAboutBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("About ZRCola"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("ZRColaAbout") );
~wxZRColaAboutBase();
};
///////////////////////////////////////////////////////////////////////////////
/// Class wxZRColaUpdaterBase
///////////////////////////////////////////////////////////////////////////////
class wxZRColaUpdaterBase : public wxDialog
{
private:
protected:
wxTextCtrl* m_log;
wxButton* m_buttonUpdate;
wxButton* m_buttonClose;
// Virtual event handlers, overide them in your derived class
virtual void OnIdle( wxIdleEvent& event ) { event.Skip(); }
virtual void OnUpdate( wxCommandEvent& event ) { event.Skip(); }
virtual void OnClose( wxCommandEvent& event ) { event.Skip(); }
public:
wxZRColaUpdaterBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Product Update"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("ZRColaUpdater") );
~wxZRColaUpdaterBase();
};
///////////////////////////////////////////////////////////////////////////////
/// Class wxZRColaCharRequestBase
///////////////////////////////////////////////////////////////////////////////
class wxZRColaCharRequestBase : public wxDialog
{
private:
protected:
wxStaticText* m_characterLbl;
wxTextCtrl* m_character;
wxStaticText* m_characterNote;
wxStaticText* m_contextLbl;
wxTextCtrl* m_context;
wxStaticText* m_note;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
wxZRColaCharRequestBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Request a New Character"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("ZRColaCharRequest") );
~wxZRColaCharRequestBase();
};
///////////////////////////////////////////////////////////////////////////////
/// Class wxZRColaTranslationSeqBase
///////////////////////////////////////////////////////////////////////////////
class wxZRColaTranslationSeqBase : public wxDialog
{
private:
protected:
wxStaticText* m_transLbl;
wxStaticText* m_availableLbl;
wxListBox* m_available;
wxButton* m_add;
wxButton* m_remove;
wxStaticText* m_selectedLbl;
wxListBox* m_selected;
wxButton* m_selectedUp;
wxButton* m_selectedDown;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnUpdate( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnAvailableChar( wxKeyEvent& event ) { event.Skip(); }
virtual void OnAvailableDClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAdd( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRemove( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectedChar( wxKeyEvent& event ) { event.Skip(); }
virtual void OnSelectedDClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectedUp( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectedDown( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
wxZRColaTranslationSeqBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Custom Translation Sequence"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("ZRColaTranslationSeq") );
~wxZRColaTranslationSeqBase();
};
#endif //__ZRCOLAGUI_H__

View File

@ -93,24 +93,24 @@ void wxZRColaComposerPanel::SynchronizePanels()
std::wstring dst(src.data(), len), dst2;
ZRCola::mapping_vector map;
m_mapping.clear();
if (app->m_mainWnd->m_composition) {
// ZRCola Decomposed => ZRCola Composed should decompose first.
app->m_t_db.TranslateInv(ZRCOLA_TRANSEQID_DEFAULT, dst.data(), dst.size(), dst2, &map);
m_mapping.push_back(std::move(map));
app->m_t_db.Translate(ZRCOLA_TRANSEQID_DEFAULT, dst2.data(), dst2.size(), dst, &map);
m_mapping.push_back(std::move(map));
}
// Other translations
const ZRCola::transetid_t *sets_begin, *sets_end;
GetTranslationSeq(sets_begin, sets_end);
m_mapping.clear();
for (auto s = sets_begin; s != sets_end; ++s) {
if (*s == 0) {
// ZRCola Decomposed => ZRCola Composed should decompose first.
app->m_t_db.TranslateInv(*s, dst.data(), dst.size(), dst2, &map);
m_mapping.push_back(std::move(map));
app->m_t_db.Translate(*s, dst2.data(), dst2.size(), dst, &map);
m_mapping.push_back(std::move(map));
} else {
// Other translates
app->m_t_db.Translate(*s, dst.data(), dst.size(), dst2, &map);
m_mapping.push_back(std::move(map));
dst = std::move(dst2);
}
app->m_t_db.Translate(*s, dst.data(), dst.size(), dst2, &map);
m_mapping.push_back(std::move(map));
dst = std::move(dst2);
}
m_source->GetSelection(&m_selSource.first, &m_selSource.second);
@ -137,24 +137,24 @@ void wxZRColaComposerPanel::SynchronizePanels()
std::wstring dst(src.data(), len), dst2;
ZRCola::mapping_vector map;
m_mapping.clear();
// Other translations
const ZRCola::transetid_t *sets_begin, *sets_end;
GetTranslationSeq(sets_begin, sets_end);
m_mapping.clear();
for (auto s = sets_end; (s--) != sets_begin;) {
if (*s == 0) {
// ZRCola Decomposed => ZRCola Composed
app->m_t_db.TranslateInv(*s, dst.data(), dst.size(), &app->m_lc_db, app->m_mainWnd->m_settings->m_lang, dst2, &map);
} else {
// Other translates
app->m_t_db.TranslateInv(*s, dst.data(), dst.size(), dst2, &map);
}
app->m_t_db.TranslateInv(*s, dst.data(), dst.size(), dst2, &map);
dst = std::move(dst2);
map.invert();
m_mapping.push_back(std::move(map));
}
if (app->m_mainWnd->m_composition) {
// ZRCola Decomposed => ZRCola Composed
app->m_t_db.TranslateInv(ZRCOLA_TRANSEQID_DEFAULT, dst.data(), dst.size(), &app->m_lc_db, app->m_mainWnd->m_settings->m_lang, dst2, &map);
}
m_destination->GetSelection(&m_selDestination.first, &m_selDestination.second);
// Update destination HEX dump.

View File

@ -113,7 +113,13 @@ inline void wxZRColaComposerPanel::GetTranslationSeq(_Out_ const ZRCola::transet
{
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
if (app->m_mainWnd->m_transeq_id != ZRCOLA_TRANSEQID_CUSTOM) {
if (app->m_mainWnd->m_transeq_id == ZRCOLA_TRANSEQID_DEFAULT) {
sets_begin = NULL;
sets_end = NULL;
} else if (app->m_mainWnd->m_transeq_id == ZRCOLA_TRANSEQID_CUSTOM) {
sets_begin = app->m_mainWnd->m_transeq->m_transeq.data();
sets_end = sets_begin + app->m_mainWnd->m_transeq->m_transeq.size();
} else {
size_t start;
if (app->m_tsq_db.idxTranSeq.find(ZRCola::transeq_db::transeq(app->m_mainWnd->m_transeq_id), start)) {
const auto &ts = app->m_tsq_db.idxTranSeq[start];
@ -123,9 +129,6 @@ inline void wxZRColaComposerPanel::GetTranslationSeq(_Out_ const ZRCola::transet
sets_begin = NULL;
sets_end = NULL;
}
} else {
sets_begin = app->m_mainWnd->m_transeq->m_transeq.data();
sets_end = sets_begin + app->m_mainWnd->m_transeq->m_transeq.size();
}
}

View File

@ -25,38 +25,42 @@
//////////////////////////////////////////////////////////////////////////
wxBEGIN_EVENT_TABLE(wxZRColaFrame, wxZRColaFrameBase)
EVT_MENU (wxID_EXIT , wxZRColaFrame::OnExit )
EVT_MENU (wxID_EXIT , wxZRColaFrame::OnExit )
EVT_UPDATE_UI_RANGE(wxID_CUT , wxID_CLEAR , wxZRColaFrame::OnForwardEventUpdate )
EVT_MENU_RANGE (wxID_CUT , wxID_CLEAR , wxZRColaFrame::OnForwardEvent )
EVT_UPDATE_UI (wxID_SELECTALL , wxZRColaFrame::OnForwardEventUpdate )
EVT_MENU (wxID_SELECTALL , wxZRColaFrame::OnForwardEvent )
EVT_UPDATE_UI_RANGE(wxID_CUT , wxID_CLEAR , wxZRColaFrame::OnForwardEventUpdate )
EVT_MENU_RANGE (wxID_CUT , wxID_CLEAR , wxZRColaFrame::OnForwardEvent )
EVT_UPDATE_UI (wxID_SELECTALL , wxZRColaFrame::OnForwardEventUpdate )
EVT_MENU (wxID_SELECTALL , wxZRColaFrame::OnForwardEvent )
EVT_MENU (wxID_CHARACTER_SELECTOR , wxZRColaFrame::OnInsertCharacter )
EVT_MENU (wxID_CHARACTER_SELECTOR , wxZRColaFrame::OnInsertCharacter )
EVT_UPDATE_UI_RANGE(wxID_SEND_DESTINATION , wxID_SEND_ABORT, wxZRColaFrame::OnSendUpdate )
EVT_MENU (wxID_COPY_DESTINATION_AND_RETURN , wxZRColaFrame::OnCopyDestinationAndReturn )
EVT_MENU (wxID_SEND_DESTINATION , wxZRColaFrame::OnSendDestination )
EVT_MENU (wxID_COPY_SOURCE_AND_RETURN , wxZRColaFrame::OnCopySourceAndReturn )
EVT_MENU (wxID_SEND_SOURCE , wxZRColaFrame::OnSendSource )
EVT_MENU (wxID_SEND_ABORT , wxZRColaFrame::OnSendAbort )
EVT_UPDATE_UI_RANGE(wxID_SEND_DESTINATION , wxID_SEND_ABORT , wxZRColaFrame::OnSendUpdate )
EVT_MENU (wxID_COPY_DESTINATION_AND_RETURN , wxZRColaFrame::OnCopyDestinationAndReturn )
EVT_MENU (wxID_SEND_DESTINATION , wxZRColaFrame::OnSendDestination )
EVT_MENU (wxID_COPY_SOURCE_AND_RETURN , wxZRColaFrame::OnCopySourceAndReturn )
EVT_MENU (wxID_SEND_SOURCE , wxZRColaFrame::OnSendSource )
EVT_MENU (wxID_SEND_ABORT , wxZRColaFrame::OnSendAbort )
EVT_MENU (wxID_SETTINGS , wxZRColaFrame::OnSettings )
EVT_MENU (wxID_COMPOSITION_MENU , wxZRColaFrame::OnCompositionMenu )
EVT_MENU (wxID_COMPOSITION_TOOLBAR , wxZRColaFrame::OnCompositionToolbar )
EVT_MENU_RANGE (wxID_TRANSLATION_SEQ_DEFAULT, wxID_TRANSLATION_SEQ_END, wxZRColaFrame::OnTranslationSeqMenu )
EVT_UPDATE_UI (wxID_TOOLBAR_EDIT , wxZRColaFrame::OnToolbarEditUpdate )
EVT_MENU (wxID_TOOLBAR_EDIT , wxZRColaFrame::OnToolbarEdit )
EVT_UPDATE_UI (wxID_TOOLBAR_TRANSLATE , wxZRColaFrame::OnToolbarTranslateUpdate )
EVT_MENU (wxID_TOOLBAR_TRANSLATE , wxZRColaFrame::OnToolbarTranslate )
EVT_UPDATE_UI (wxID_PANEL_CHRGRPS , wxZRColaFrame::OnPanelCharacterCatalogUpdate)
EVT_MENU (wxID_PANEL_CHRGRPS , wxZRColaFrame::OnPanelCharacterCatalog )
EVT_MENU (wxID_FOCUS_CHARACTER_CATALOG , wxZRColaFrame::OnPanelCharacterCatalogFocus )
EVT_MENU (wxID_SETTINGS , wxZRColaFrame::OnSettings )
EVT_MENU (wxID_HELP_INSTRUCTIONS , wxZRColaFrame::OnHelpInstructions )
EVT_MENU (wxID_HELP_SHORTCUTS , wxZRColaFrame::OnHelpShortcuts )
EVT_UPDATE_UI (wxID_TOOLBAR_EDIT , wxZRColaFrame::OnToolbarEditUpdate )
EVT_MENU (wxID_TOOLBAR_EDIT , wxZRColaFrame::OnToolbarEdit )
EVT_UPDATE_UI (wxID_TOOLBAR_TRANSLATE , wxZRColaFrame::OnToolbarTranslateUpdate )
EVT_MENU (wxID_TOOLBAR_TRANSLATE , wxZRColaFrame::OnToolbarTranslate )
EVT_UPDATE_UI (wxID_PANEL_CHRGRPS , wxZRColaFrame::OnPanelCharacterCatalogUpdate)
EVT_MENU (wxID_PANEL_CHRGRPS , wxZRColaFrame::OnPanelCharacterCatalog )
EVT_MENU (wxID_FOCUS_CHARACTER_CATALOG , wxZRColaFrame::OnPanelCharacterCatalogFocus )
EVT_MENU (wxID_HELP_REQCHAR , wxZRColaFrame::OnHelpReqChar )
EVT_MENU (wxID_HELP_UPDATE , wxZRColaFrame::OnHelpUpdate )
EVT_MENU (wxID_ABOUT , wxZRColaFrame::OnHelpAbout )
EVT_MENU (wxID_HELP_INSTRUCTIONS , wxZRColaFrame::OnHelpInstructions )
EVT_MENU (wxID_HELP_SHORTCUTS , wxZRColaFrame::OnHelpShortcuts )
EVT_MENU (wxID_HELP_REQCHAR , wxZRColaFrame::OnHelpReqChar )
EVT_MENU (wxID_HELP_UPDATE , wxZRColaFrame::OnHelpUpdate )
EVT_MENU (wxID_ABOUT , wxZRColaFrame::OnHelpAbout )
wxEND_EVENT_TABLE()
@ -65,7 +69,8 @@ wxZRColaFrame::wxZRColaFrame() :
m_chrSelect(NULL),
m_settings(NULL),
m_chrReq(NULL),
m_transeq_id(0), // By default use predefined translation sequence 0 (ZRCola Decomposed >> Composed)
m_composition(true),
m_transeq_id(ZRCOLA_TRANSEQID_DEFAULT),
m_transeq(NULL),
wxZRColaFrameBase(NULL)
{
@ -80,14 +85,26 @@ wxZRColaFrame::wxZRColaFrame() :
// Populate list of translation sequences.
auto app = dynamic_cast<ZRColaApp*>(wxTheApp);
m_toolTranslationSeq->Clear();
for (size_t i = 0, n = app->m_tsq_db.idxRank.size(); i < n; i++) {
const ZRCola::transeq_db::transeq &ts = app->m_tsq_db.idxRank[i];
wxString
name(ts.name(), ts.name_len()),
name_tran(wxGetTranslation(name, wxT("ZRCola-zrcdb")));
m_toolTranslationSeq->Append(name_tran, reinterpret_cast<void*>(ts.seq));
{
wxString name_tran(_("No Translation"));
m_menuTranslationSeq->AppendRadioItem(wxID_TRANSLATION_SEQ_DEFAULT, name_tran);
m_toolTranslationSeq->Append(name_tran, reinterpret_cast<void*>(ZRCOLA_TRANSEQID_DEFAULT));
}
for (size_t i = 0, n = app->m_tsq_db.idxRank.size(); ; i++) {
if (i < n) {
const ZRCola::transeq_db::transeq &ts = app->m_tsq_db.idxRank[i];
wxString
name(ts.name(), ts.name_len()),
name_tran(wxGetTranslation(name, wxT("ZRCola-zrcdb")));
m_menuTranslationSeq->AppendRadioItem(wxID_TRANSLATION_SEQ_START + i, name_tran);
m_toolTranslationSeq->Append(name_tran, reinterpret_cast<void*>(ts.seq));
} else {
wxString name_tran(_("Custom Translation..."));
m_menuTranslationSeq->AppendRadioItem(wxID_TRANSLATION_SEQ_START + i, name_tran);
m_toolTranslationSeq->Append(name_tran, reinterpret_cast<void*>(ZRCOLA_TRANSEQID_CUSTOM));
break;
}
}
m_toolTranslationSeq->Append(_("Custom Translation..."), reinterpret_cast<void*>(ZRCOLA_TRANSEQID_CUSTOM));
// Load main window icons.
#ifdef __WINDOWS__
@ -159,15 +176,26 @@ wxZRColaFrame::wxZRColaFrame() :
wxPersistentAuiManager(&m_mgr).Restore();
persist_mgr.RegisterAndRestore(this, new wxPersistentZRColaFrame(this));
// Populate list of translation sequences.
// Update (de)composition selection.
if (m_composition) {
m_menuItemComposition->Check(true);
m_toolComposition->SetState(m_toolComposition->GetState() | wxAUI_BUTTON_STATE_CHECKED);
} else {
m_menuItemComposition->Check(false);
m_toolComposition->SetState(m_toolComposition->GetState() & ~wxAUI_BUTTON_STATE_CHECKED);
}
// Update translation sequence selection.
for (unsigned int i = 0, n = m_toolTranslationSeq->GetCount(); ; i++) {
if (i < n) {
if (static_cast<ZRCola::transeqid_t>((size_t)m_toolTranslationSeq->GetClientData(i)) == m_transeq_id) {
m_menuTranslationSeq->Check(wxID_TRANSLATION_SEQ_DEFAULT + i, true);
m_toolTranslationSeq->SetSelection(i);
break;
}
} else {
m_transeq_id = static_cast<ZRCola::transeqid_t>((size_t)m_toolTranslationSeq->GetClientData(0));
m_transeq_id = ZRCOLA_TRANSEQID_DEFAULT;
m_menuTranslationSeq->Check(wxID_TRANSLATION_SEQ_DEFAULT, true);
m_toolTranslationSeq->SetSelection(0);
break;
}
@ -300,6 +328,33 @@ void wxZRColaFrame::OnSendAbort(wxCommandEvent& event)
}
void wxZRColaFrame::OnCompositionMenu(wxCommandEvent& event)
{
m_composition = m_menuItemComposition->IsChecked();
m_toolComposition->SetState((m_toolComposition->GetState() & ~wxAUI_BUTTON_STATE_CHECKED) | (m_composition ? wxAUI_BUTTON_STATE_CHECKED : 0));
m_toolbarTranslate->Refresh();
// Notify source text something changed and should re-translate.
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
m_panel->m_source->ProcessWindowEvent(event2);
event.Skip();
}
void wxZRColaFrame::OnCompositionToolbar(wxCommandEvent& event)
{
m_composition = (m_toolComposition->GetState() & wxAUI_BUTTON_STATE_CHECKED) ? true : false;
m_menuItemComposition->Check(m_composition);
// Notify source text something changed and should re-translate.
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
m_panel->m_source->ProcessWindowEvent(event2);
event.Skip();
}
void wxZRColaFrame::OnSettings(wxCommandEvent& event)
{
m_settings->ShowModal();
@ -361,19 +416,28 @@ void wxZRColaFrame::OnToolbarTranslate(wxCommandEvent& event)
}
void wxZRColaFrame::OnTranslationSeqMenu(wxCommandEvent& event)
{
int idx = event.GetId() - wxID_TRANSLATION_SEQ_DEFAULT;
ZRCola::transeqid_t transeq_id = static_cast<ZRCola::transeqid_t>((size_t)m_toolTranslationSeq->GetClientData(idx));
DoSetTranslationSeq(idx, transeq_id);
m_toolTranslationSeq->Select(idx);
}
void wxZRColaFrame::OnTranslationSeqChoice(wxCommandEvent& event)
{
int idx = event.GetSelection();
ZRCola::transeqid_t transeq_id = static_cast<ZRCola::transeqid_t>((size_t)event.GetClientData());
if (m_transeq_id != transeq_id) {
m_transeq_id = transeq_id;
// Notify source text something changed and should re-translate.
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
m_panel->m_source->ProcessWindowEvent(event2);
}
DoSetTranslationSeq(idx, transeq_id);
if (m_transeq_id == ZRCOLA_TRANSEQID_CUSTOM)
m_transeq->ShowModal();
if (m_transeq_id == ZRCOLA_TRANSEQID_DEFAULT)
m_menuTranslationSeq->Check(wxID_TRANSLATION_SEQ_DEFAULT, true);
else
m_menuTranslationSeq->Check(wxID_TRANSLATION_SEQ_DEFAULT + idx, true);
}
@ -559,11 +623,40 @@ void wxZRColaFrame::DoCopyAndReturn(const wxString& str)
m_hWndSource = NULL;
// Select all input in composer and source to prepare for the overwrite next time.
m_panel->m_source ->SelectAll();
m_panel->m_source->SelectAll();
m_panel->m_destination->SelectAll();
}
void wxZRColaFrame::DoSetTranslationSeq(int idx, ZRCola::transeqid_t transeq_id)
{
if (transeq_id == ZRCOLA_TRANSEQID_CUSTOM) {
// Prompt user to modify translation.
if (m_transeq->ShowModal() != wxID_OK)
return;
if (m_transeq->m_transeq.empty()) {
// User submitted an empty translation. Revert to "No Translation" case.
m_transeq_id = ZRCOLA_TRANSEQID_DEFAULT;
m_menuTranslationSeq->Check(wxID_TRANSLATION_SEQ_DEFAULT, true);
m_toolTranslationSeq->SetSelection(0);
} else {
m_transeq_id = ZRCOLA_TRANSEQID_CUSTOM;
m_menuTranslationSeq->Check(wxID_TRANSLATION_SEQ_DEFAULT + idx, true);
}
} else if (m_transeq_id != transeq_id) {
// User choose a new translation sequence.
m_transeq_id = transeq_id;
m_menuTranslationSeq->Check(wxID_TRANSLATION_SEQ_DEFAULT + idx, true);
} else
return;
// Notify source text something changed and should re-translate.
wxCommandEvent event2(wxEVT_COMMAND_TEXT_UPDATED);
m_panel->m_source->ProcessWindowEvent(event2);
}
#ifdef __WXMSW__
WXLRESULT wxZRColaFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
@ -573,7 +666,7 @@ WXLRESULT wxZRColaFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM
WXHWND hWndSource = ::GetForegroundWindow();
switch (wParam) {
case wxZRColaHKID_INVOKE_TRANSLATE : m_panel->m_source ->SetFocus(); break;
case wxZRColaHKID_INVOKE_TRANSLATE: m_panel->m_source->SetFocus(); break;
case wxZRColaHKID_INVOKE_TRANSLATE_INV: m_panel->m_destination->SetFocus(); break;
default:
wxFAIL_MSG(wxT("not our registered shortcut"));
@ -588,10 +681,10 @@ WXLRESULT wxZRColaFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM
m_hWndSource = hWndSource;
//if (m_state == wxABS_FLOAT) {
if (IsIconized())
::SendMessage(m_hWnd, WM_SYSCOMMAND, SC_RESTORE, 0);
::SetActiveWindow(m_hWnd);
::SetForegroundWindow(m_hWnd);
if (IsIconized())
::SendMessage(m_hWnd, WM_SYSCOMMAND, SC_RESTORE, 0);
::SetActiveWindow(m_hWnd);
::SetForegroundWindow(m_hWnd);
//} else if (wxAppBarIsDocked(m_state)) {
// // ZRCola window is currently docked.
@ -606,7 +699,8 @@ WXLRESULT wxZRColaFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM
// wxFAIL_MSG(wxT("unsupported application bar state"));
return 0;
} else
}
else
return wxZRColaFrameBase::MSWWindowProc(message, wParam, lParam);
}
@ -628,6 +722,7 @@ void wxPersistentZRColaFrame::Save() const
auto wnd = static_cast<const wxZRColaFrame*>(GetWindow()); // dynamic_cast is not reliable as we are typically called late in the wxTopLevelWindowMSW destructor.
SaveValue(wxT("composition"), wnd->m_composition);
SaveValue(wxT("transeqId"), static_cast<int>(wnd->m_transeq_id));
wxPersistentZRColaComposerPanel(wnd->m_panel).Save();
@ -646,5 +741,11 @@ bool wxPersistentZRColaFrame::Restore()
if (RestoreValue(wxT("transeqId"), &num))
wnd->m_transeq_id = num;
bool b;
if (RestoreValue(wxT("composition"), &b))
wnd->m_composition = b;
else
wnd->m_composition = wnd->m_transeq_id == ZRCOLA_TRANSEQID_DEFAULT;
return wxPersistentTLWEx::Restore();
}

View File

@ -60,6 +60,9 @@ public:
enum
{
wxID_FOCUS_CHARACTER_CATALOG = 2000,
wxID_TRANSLATION_SEQ_DEFAULT = 2001,
wxID_TRANSLATION_SEQ_START = 2002,
wxID_TRANSLATION_SEQ_END = 2100,
};
wxZRColaFrame();
@ -79,6 +82,8 @@ protected:
void OnSendSource(wxCommandEvent& event);
void OnCopySourceAndReturn(wxCommandEvent& event);
void OnSendAbort(wxCommandEvent& event);
void OnCompositionMenu(wxCommandEvent& event);
void OnCompositionToolbar(wxCommandEvent& event);
void OnSettings(wxCommandEvent& event);
virtual void OnIdle(wxIdleEvent& event);
void OnTaskbarIconClick(wxTaskBarIconEvent& event);
@ -87,6 +92,7 @@ protected:
void OnToolbarEdit(wxCommandEvent& event);
void OnToolbarTranslateUpdate(wxUpdateUIEvent& event);
void OnToolbarTranslate(wxCommandEvent& event);
void OnTranslationSeqMenu(wxCommandEvent& event);
virtual void OnTranslationSeqChoice(wxCommandEvent& event);
void OnPanelCharacterCatalogUpdate(wxUpdateUIEvent& event);
void OnPanelCharacterCatalog(wxCommandEvent& event);
@ -117,6 +123,7 @@ protected:
private:
void DoSend(const wxString& str);
void DoCopyAndReturn(const wxString& str);
void DoSetTranslationSeq(int idx, ZRCola::transeqid_t transeq_id);
protected:
#ifdef __WXMSW__
@ -129,6 +136,7 @@ protected:
wxZRColaCharSelect *m_chrSelect; ///< Character selection dialog
wxZRColaCharRequest *m_chrReq; ///< Request a New Character dialog
wxZRColaSettings *m_settings; ///< Configuration dialog
bool m_composition; ///< Is (de)composition enabled?
ZRCola::transeqid_t m_transeq_id; ///< Translation sequence ID
wxZRColaTranslationSeq *m_transeq; ///< Custom translation sequence dialog
};

View File

@ -74,20 +74,20 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_menuEdit->AppendSeparator();
wxMenuItem* m_menuSelectAll;
m_menuSelectAll = new wxMenuItem( m_menuEdit, wxID_SELECTALL, wxString( _("Select &All") ) + wxT('\t') + wxT("Ctrl+A"), _("Select all text"), wxITEM_NORMAL );
m_menuEdit->Append( m_menuSelectAll );
wxMenuItem* m_menuItemSelectAll;
m_menuItemSelectAll = new wxMenuItem( m_menuEdit, wxID_SELECTALL, wxString( _("Select &All") ) + wxT('\t') + wxT("Ctrl+A"), _("Select all text"), wxITEM_NORMAL );
m_menuEdit->Append( m_menuItemSelectAll );
m_menuEdit->AppendSeparator();
wxMenuItem* m_menuCharSelect;
m_menuCharSelect = new wxMenuItem( m_menuEdit, wxID_CHARACTER_SELECTOR, wxString( _("Find C&haracter...") ) + wxT('\t') + wxT("F8"), _("Display character search to select character to insert into text"), wxITEM_NORMAL );
wxMenuItem* m_menuItemCharSelect;
m_menuItemCharSelect = new wxMenuItem( m_menuEdit, wxID_CHARACTER_SELECTOR, wxString( _("Find C&haracter...") ) + wxT('\t') + wxT("F8"), _("Display character search to select character to insert into text"), wxITEM_NORMAL );
#ifdef __WXMSW__
m_menuCharSelect->SetBitmaps( wxIcon( wxT("char_select.ico"), wxBITMAP_TYPE_ICO_RESOURCE, FromDIP(16), FromDIP(16) ) );
m_menuItemCharSelect->SetBitmaps( wxIcon( wxT("char_select.ico"), wxBITMAP_TYPE_ICO_RESOURCE, FromDIP(16), FromDIP(16) ) );
#elif (defined( __WXGTK__ ) || defined( __WXOSX__ ))
m_menuCharSelect->SetBitmap( wxIcon( wxT("char_select.ico"), wxBITMAP_TYPE_ICO_RESOURCE, FromDIP(16), FromDIP(16) ) );
m_menuItemCharSelect->SetBitmap( wxIcon( wxT("char_select.ico"), wxBITMAP_TYPE_ICO_RESOURCE, FromDIP(16), FromDIP(16) ) );
#endif
m_menuEdit->Append( m_menuCharSelect );
m_menuEdit->Append( m_menuItemCharSelect );
m_menuEdit->AppendSeparator();
@ -138,6 +138,15 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_menuEdit->AppendSeparator();
m_menuItemComposition = new wxMenuItem( m_menuEdit, wxID_COMPOSITION_MENU, wxString( _("&ZRCola (De)composition") ) , _("Toggle ZRCola character (De)composition"), wxITEM_CHECK );
m_menuEdit->Append( m_menuItemComposition );
m_menuTranslationSeq = new wxMenu();
wxMenuItem* m_menuTranslationSeqItem = new wxMenuItem( m_menuEdit, wxID_ANY, _("Tra&nslation"), wxEmptyString, wxITEM_NORMAL, m_menuTranslationSeq );
m_menuEdit->Append( m_menuTranslationSeqItem );
m_menuEdit->AppendSeparator();
wxMenuItem* m_menuSettings;
m_menuSettings = new wxMenuItem( m_menuEdit, wxID_SETTINGS, wxString( _("&Settings...") ) , _("Open program configuration dialog"), wxITEM_NORMAL );
m_menuEdit->Append( m_menuSettings );
@ -207,6 +216,10 @@ wxZRColaFrameBase::wxZRColaFrameBase( wxWindow* parent, wxWindowID id, const wxS
m_toolSendSource = m_toolbarTranslate->AddTool( wxID_SEND_SOURCE, _("Send Decomposed"), wxIcon( wxT("send_source.ico"), wxBITMAP_TYPE_ICO_RESOURCE, FromDIP(24), FromDIP(24) ), wxNullBitmap, wxITEM_NORMAL, _("Send Decomposed"), _("Send decomposed text to source window"), NULL );
m_toolbarTranslate->AddSeparator();
m_toolComposition = m_toolbarTranslate->AddTool( wxID_COMPOSITION_TOOLBAR, _("ZRCola (De)composition"), wxIcon( wxT("composition.ico"), wxBITMAP_TYPE_ICO_RESOURCE, FromDIP(24), FromDIP(24) ), wxNullBitmap, wxITEM_CHECK, _("ZRCola (De)composition"), _("Toggle ZRCola character (De)composition"), NULL );
wxArrayString m_toolTranslationSeqChoices;
m_toolTranslationSeq = new wxChoice( m_toolbarTranslate, wxID_ANY, wxDefaultPosition, FromDIP(wxSize( 250,-1 )), m_toolTranslationSeqChoices, 0 );
m_toolTranslationSeq->SetSelection( 0 );

View File

@ -68,6 +68,7 @@ class wxZRColaFrameBase : public wxFrame
wxID_SEND_SOURCE,
wxID_COPY_SOURCE_AND_RETURN,
wxID_SEND_ABORT,
wxID_COMPOSITION_MENU,
wxID_SETTINGS,
wxID_TOOLBAR_EDIT,
wxID_TOOLBAR_TRANSLATE,
@ -75,12 +76,15 @@ class wxZRColaFrameBase : public wxFrame
wxID_HELP_INSTRUCTIONS,
wxID_HELP_SHORTCUTS,
wxID_HELP_REQCHAR,
wxID_HELP_UPDATE
wxID_HELP_UPDATE,
wxID_COMPOSITION_TOOLBAR
};
wxMenuBar* m_menubar;
wxMenu* m_menuProgram;
wxMenu* m_menuEdit;
wxMenuItem* m_menuItemComposition;
wxMenu* m_menuTranslationSeq;
wxMenu* m_menuView;
wxMenu* m_menuHelp;
wxAuiToolBar* m_toolbarEdit;
@ -91,6 +95,7 @@ class wxZRColaFrameBase : public wxFrame
wxAuiToolBarItem* m_toolCharSelect;
wxAuiToolBarItem* m_toolSendDestination;
wxAuiToolBarItem* m_toolSendSource;
wxAuiToolBarItem* m_toolComposition;
wxChoice* m_toolTranslationSeq;
wxZRColaCharacterCatalogPanel* m_panelChrCat;
wxStatusBar* m_statusBar;

View File

@ -417,26 +417,16 @@ int _tmain(int argc, _TCHAR *argv[])
if (src.SelectTranlationSets(rs)) {
size_t count = src.GetRecordsetCount(rs);
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
ZRCola::DBSource::transet ts;
ZRCola::transet_db db;
// Preallocate memory.
db.idxTranSet.reserve((count+1));
db.data .reserve((count+1)*4);
// Add (de)composing translation set to index and data.
ts.set = 0;
ts.src = L"ZRCola Decomposed";
ts.dst = L"ZRCola Composed";
db << ts;
if (build_pot) {
pot.insert(ts.src);
pot.insert(ts.dst);
}
// Parse translation sets and build index and data.
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
// Read translation set from the database.
ZRCola::DBSource::transet ts;
if (src.GetTranslationSet(rs, ts)) {
if (build_pot) {
pot.insert(ts.src);
@ -501,7 +491,6 @@ int _tmain(int argc, _TCHAR *argv[])
if (src.SelectTranlationSeqs(rs)) {
size_t count = src.GetRecordsetCount(rs);
if (count < 0xffffffff) { // 4G check (-1 is reserved for error condition)
ZRCola::DBSource::transeq ts;
ZRCola::transeq_db db;
// Preallocate memory.
@ -509,18 +498,10 @@ int _tmain(int argc, _TCHAR *argv[])
db.idxRank .reserve((count+1));
db.data .reserve((count+1)*4);
// Add basic ZRCola translation sequence to index and data.
ts.seq = 0;
ts.rank = 0;
ts.name = L"ZRCola (De)composition";
ts.sets.push_back(0);
db << ts;
if (build_pot)
pot.insert(ts.name);
// Parse translation sequences and build index and data.
for (; !ZRCola::DBSource::IsEOF(rs); rs->MoveNext()) {
// Read translation sequence from the database.
ZRCola::DBSource::transeq ts;
if (src.GetTranslationSeq(rs, ts)) {
if (build_pot)
pot.insert(ts.name);

View File

@ -34,10 +34,15 @@
#pragma warning(disable: 4251)
#pragma warning(disable: 4512)
///
/// Translation disabled/ZRCola (De)Composition
///
#define ZRCOLA_TRANSEQID_DEFAULT ((ZRCola::transeqid_t)0)
///
/// Custom translation sequence ID
///
#define ZRCOLA_TRANSEQID_CUSTOM ((ZRCola::transeqid_t)-1)
#define ZRCOLA_TRANSEQID_CUSTOM ((ZRCola::transeqid_t)-1)
namespace ZRCola {

Binary file not shown.

View File

@ -64,63 +64,24 @@ msgstr ""
msgid "Cyrillic (Belarusian)"
msgstr ""
msgid "Cyrillic (Belarusian) » Latin (English)"
msgstr ""
msgid "Cyrillic (Belarusian) » Latin (Slovenian)"
msgstr ""
msgid "Cyrillic (Bulgarian)"
msgstr ""
msgid "Cyrillic (Bulgarian) » Latin (English)"
msgstr ""
msgid "Cyrillic (Bulgarian) » Latin (Slovenian)"
msgstr ""
msgid "Cyrillic (GOST2000)"
msgstr ""
msgid "Cyrillic (Macedonian)"
msgstr ""
msgid "Cyrillic (Macedonian) » Latin (English)"
msgstr ""
msgid "Cyrillic (Macedonian) » Latin (Slovenian)"
msgstr ""
msgid "Cyrillic (Russian)"
msgstr ""
msgid "Cyrillic (Russian) » Latin (English)"
msgstr ""
msgid "Cyrillic (Russian) » Latin (Slovenian)"
msgstr ""
msgid "Cyrillic (Serbian)"
msgstr ""
msgid "Cyrillic (Serbian) » Latin"
msgstr ""
msgid "Cyrillic (Ukrainian)"
msgstr ""
msgid "Cyrillic (Ukrainian) » Latin (English)"
msgstr ""
msgid "Cyrillic (Ukrainian) » Latin (Slovenian)"
msgstr ""
msgid "Cyrillic BdC"
msgstr ""
msgid "Cyrillic » Latin (GOST2000)"
msgstr ""
msgid "Czech"
msgstr ""
@ -175,9 +136,6 @@ msgstr ""
msgid "Hungarian"
msgstr ""
msgid "IPA"
msgstr ""
msgid "Irish Gaelic"
msgstr ""
@ -283,15 +241,6 @@ msgstr ""
msgid "Latin"
msgstr ""
msgid "Latin (English)"
msgstr ""
msgid "Latin (GOST2000)"
msgstr ""
msgid "Latin (Slovenian)"
msgstr ""
msgid "Latin ALE"
msgstr ""
@ -304,9 +253,6 @@ msgstr ""
msgid "Latin » Cyrillic (Bulgarian)"
msgstr ""
msgid "Latin » Cyrillic (GOST2000)"
msgstr ""
msgid "Latin » Cyrillic (Macedonian)"
msgstr ""
@ -568,12 +514,6 @@ msgstr ""
msgid "Quotes"
msgstr ""
msgid "Rigler transcription"
msgstr ""
msgid "Rigler transcription » IPA"
msgstr ""
msgid "Romanian"
msgstr ""
@ -706,15 +646,6 @@ msgstr ""
msgid "Units"
msgstr ""
msgid "ZRCola (De)composition"
msgstr ""
msgid "ZRCola Composed"
msgstr ""
msgid "ZRCola Decomposed"
msgstr ""
msgid "l+j l|j"
msgstr ""