Skip to content

Commit

Permalink
Rename "Keep linebreaks if... Preceded by dot" to "Preceded by end ma…
Browse files Browse the repository at this point in the history
…rk (.?!)" and make postprocessing work accordingly (#32)
  • Loading branch information
manisandro committed Aug 23, 2015
1 parent a928d64 commit f3290b0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions gtk/data/gimagereader.ui
Original file line number Diff line number Diff line change
Expand Up @@ -2515,10 +2515,10 @@ Swedish: Mats Olofsson &lt;mats.olofsson@bokforlaget-alerta.se&gt;</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="menuitem:output.stripcrlf.keepdot">
<object class="GtkCheckMenuItem" id="menuitem:output.stripcrlf.keependmark">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Preceded by dot</property>
<property name="label" translatable="yes">Preceded by end mark (.?!)</property>
<property name="use_underline">True</property>
</object>
</child>
Expand Down
8 changes: 4 additions & 4 deletions gtk/src/OutputManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ OutputManager::OutputManager()
m_textView = Builder("textview:output");
m_searchEntry = Builder("entry:output.search");
m_replaceEntry = Builder("entry:output.replace");
m_filterKeepIfDot = Builder("menuitem:output.stripcrlf.keepdot");
m_filterKeepIfEndMark = Builder("menuitem:output.stripcrlf.keependmark");
m_filterKeepIfQuote = Builder("menuitem:output.stripcrlf.keepquote");
m_filterJoinHyphen = Builder("menuitem:output.stripcrlf.joinhyphen");
m_filterJoinSpace = Builder("menuitem:output.stripcrlf.joinspace");
Expand Down Expand Up @@ -106,7 +106,7 @@ OutputManager::OutputManager()
CONNECTP(m_textBuffer, cursor_position, [this]{ m_textBuffer->save_region_bounds(m_textView->is_focus()); });
CONNECTP(m_textBuffer, has_selection, [this]{ m_textBuffer->save_region_bounds(m_textView->is_focus()); });

MAIN->getConfig()->addSetting(new SwitchSettingT<Gtk::CheckMenuItem>("keepdot", "menuitem:output.stripcrlf.keepdot"));
MAIN->getConfig()->addSetting(new SwitchSettingT<Gtk::CheckMenuItem>("keepdot", "menuitem:output.stripcrlf.keependmark"));
MAIN->getConfig()->addSetting(new SwitchSettingT<Gtk::CheckMenuItem>("keepquote", "menuitem:output.stripcrlf.keepquote"));
MAIN->getConfig()->addSetting(new SwitchSettingT<Gtk::CheckMenuItem>("joinhyphen", "menuitem:output.stripcrlf.joinhyphen"));
MAIN->getConfig()->addSetting(new SwitchSettingT<Gtk::CheckMenuItem>("joinspace", "menuitem:output.stripcrlf.joinspace"));
Expand Down Expand Up @@ -171,8 +171,8 @@ void OutputManager::filterBuffer()
if(m_filterKeepParagraphs->get_active()){
preChars += "\\n"; // Keep if preceded by line break
}
if(m_filterKeepIfDot->get_active()){
preChars += "\\."; // Keep if preceded by dot
if(m_filterKeepIfEndMark->get_active()){
preChars += "\\.\\?!"; // Keep if preceded by end mark (.?!)
}
if(m_filterKeepIfQuote->get_active()){
preChars += "'\""; // Keep if preceded by dot
Expand Down
2 changes: 1 addition & 1 deletion gtk/src/OutputManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private:
Gsv::View* m_textView;
Gtk::Entry* m_searchEntry;
Gtk::Entry* m_replaceEntry;
Gtk::CheckMenuItem* m_filterKeepIfDot;
Gtk::CheckMenuItem* m_filterKeepIfEndMark;
Gtk::CheckMenuItem* m_filterKeepIfQuote;
Gtk::CheckMenuItem* m_filterJoinHyphen;
Gtk::CheckMenuItem* m_filterJoinSpace;
Expand Down
6 changes: 3 additions & 3 deletions qt/src/OutputManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ OutputManager::OutputManager(const UI_MainWindow& _ui)
connect(ui.pushButtonOutputReplacementList, SIGNAL(clicked()), m_substitutionsManager, SLOT(raise()));
connect(ui.actionOutputPostprocDrawWhitespace, SIGNAL(toggled(bool)), ui.plainTextEditOutput, SLOT(setDrawWhitespace(bool)));

MAIN->getConfig()->addSetting(new ActionSetting("keepdot", ui.actionOutputPostprocKeepDot, true));
MAIN->getConfig()->addSetting(new ActionSetting("keepdot", ui.actionOutputPostprocKeepEndMark, true));
MAIN->getConfig()->addSetting(new ActionSetting("keepquote", ui.actionOutputPostprocKeepQuote));
MAIN->getConfig()->addSetting(new ActionSetting("joinhyphen", ui.actionOutputPostprocJoinHyphen, true));
MAIN->getConfig()->addSetting(new ActionSetting("joinspace", ui.actionOutputPostprocCollapseSpaces, true));
Expand Down Expand Up @@ -132,8 +132,8 @@ void OutputManager::filterBuffer()
if(ui.actionOutputPostprocKeepParagraphs->isChecked()){
preChars += "\u2029"; // Keep if preceded by line break
}
if(ui.actionOutputPostprocKeepDot->isChecked()){
preChars += "\\."; // Keep if preceded by dot
if(ui.actionOutputPostprocKeepEndMark->isChecked()){
preChars += "\\.\\?!"; // Keep if preceded by end mark (.?!)
}
if(ui.actionOutputPostprocKeepQuote->isChecked()){
preChars += "'\""; // Keep if preceded by dot
Expand Down
8 changes: 4 additions & 4 deletions qt/src/Ui_MainWindow.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public:
QAction* actionOutputReplace;
QAction* actionOutputSave;
QAction* actionOutputPostprocTitle1;
QAction* actionOutputPostprocKeepDot;
QAction* actionOutputPostprocKeepEndMark;
QAction* actionOutputPostprocKeepQuote;
QAction* actionOutputPostprocTitle2;
QAction* actionOutputPostprocJoinHyphen;
Expand Down Expand Up @@ -213,8 +213,8 @@ public:
// Output postprocessing
actionOutputPostprocTitle1 = new QAction(gettext("Keep line break if..."), MainWindow);
actionOutputPostprocTitle1->setEnabled(false);
actionOutputPostprocKeepDot = new QAction(gettext("Preceded by dot"), MainWindow);
actionOutputPostprocKeepDot->setCheckable(true);
actionOutputPostprocKeepEndMark = new QAction(gettext("Preceded by end mark (.?!)"), MainWindow);
actionOutputPostprocKeepEndMark->setCheckable(true);
actionOutputPostprocKeepQuote = new QAction(gettext("Preceded or succeeded by quote"), MainWindow);
actionOutputPostprocKeepQuote->setCheckable(true);
actionOutputPostprocTitle2 = new QAction(gettext("Other options"), MainWindow);
Expand All @@ -232,7 +232,7 @@ public:

menuOutputPostproc = new QMenu(MainWindow);
menuOutputPostproc->addAction(actionOutputPostprocTitle1);
menuOutputPostproc->addAction(actionOutputPostprocKeepDot);
menuOutputPostproc->addAction(actionOutputPostprocKeepEndMark);
menuOutputPostproc->addAction(actionOutputPostprocKeepQuote);
menuOutputPostproc->addAction(actionOutputPostprocTitle2);
menuOutputPostproc->addAction(actionOutputPostprocJoinHyphen);
Expand Down

0 comments on commit f3290b0

Please sign in to comment.