mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
gtk changes dialog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9079 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
705add840e
commit
b0a20c95ff
@ -72,18 +72,19 @@ string const ControlChanges::getChangeAuthor()
|
||||
}
|
||||
|
||||
|
||||
void ControlChanges::accept()
|
||||
bool ControlChanges::accept()
|
||||
{
|
||||
kernel().dispatch(FuncRequest(LFUN_ACCEPT_CHANGE));
|
||||
find::findNextChange(kernel().bufferview());
|
||||
return find::findNextChange(kernel().bufferview());
|
||||
}
|
||||
|
||||
|
||||
void ControlChanges::reject()
|
||||
bool ControlChanges::reject()
|
||||
{
|
||||
kernel().dispatch(FuncRequest(LFUN_REJECT_CHANGE));
|
||||
find::findNextChange(kernel().bufferview());
|
||||
return find::findNextChange(kernel().bufferview());
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
@ -43,10 +43,10 @@ public:
|
||||
std::string const getChangeAuthor();
|
||||
|
||||
/// accept the current merge
|
||||
void accept();
|
||||
bool accept();
|
||||
|
||||
/// reject the current merge
|
||||
void reject();
|
||||
bool reject();
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
|
@ -1,3 +1,10 @@
|
||||
2004-10-11 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The Changes dialog
|
||||
* Dialogs.C, Makefile.am, GChanges.C, GChanges.h
|
||||
* ControlChanges.[Ch]: make accept() and reject() return bool
|
||||
from findNextChange
|
||||
|
||||
2004-10-09 John Spray <spray_john@users.sourceforge.net>
|
||||
|
||||
* The Log dialog
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include "FormBibtex.h"
|
||||
#include "FormBox.h"
|
||||
#include "FormBranch.h"
|
||||
#include "FormChanges.h"
|
||||
#include "GChanges.h"
|
||||
#include "GCharacter.h"
|
||||
#include "FormCitation.h"
|
||||
#include "FormDocument.h"
|
||||
@ -194,8 +194,9 @@ Dialogs::DialogPtr Dialogs::build(string const & name)
|
||||
dialog->setView(new FormBox(*dialog));
|
||||
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
|
||||
} else if (name == "changes") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
dialog->setController(new ControlChanges(*dialog));
|
||||
dialog->setView(new FormChanges(*dialog));
|
||||
dialog->setView(new GChanges(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "character") {
|
||||
dialog->bc().view(new GBC(dialog->bc()));
|
||||
|
125
src/frontends/gtk/GChanges.C
Normal file
125
src/frontends/gtk/GChanges.C
Normal file
@ -0,0 +1,125 @@
|
||||
/**
|
||||
* \file GChanges.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include "GChanges.h"
|
||||
#include "ControlChanges.h"
|
||||
|
||||
#include "ghelpers.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
|
||||
GChanges::GChanges(Dialog & parent)
|
||||
: GViewCB<ControlChanges, GViewGladeB>(parent, _("Merge Changes"), false)
|
||||
{}
|
||||
|
||||
|
||||
void GChanges::doBuild()
|
||||
{
|
||||
string const gladeName = findGladeFile("changes");
|
||||
xml_ = Gnome::Glade::Xml::create(gladeName);
|
||||
|
||||
xml_->get_widget("Message", messagelabel_);
|
||||
|
||||
Gtk::Button * closebutton;
|
||||
xml_->get_widget("Close", closebutton);
|
||||
setCancel(closebutton);
|
||||
|
||||
xml_->get_widget("Accept", acceptbutton_);
|
||||
bcview().addReadOnly(acceptbutton_);
|
||||
acceptbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GChanges::onAccept));
|
||||
|
||||
xml_->get_widget("Reject", rejectbutton_);
|
||||
bcview().addReadOnly(rejectbutton_);
|
||||
rejectbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GChanges::onReject));
|
||||
|
||||
xml_->get_widget("Next", nextbutton_);
|
||||
nextbutton_->signal_clicked().connect(
|
||||
sigc::mem_fun(*this, &GChanges::onNext));
|
||||
}
|
||||
|
||||
|
||||
void GChanges::update()
|
||||
{
|
||||
onNext();
|
||||
}
|
||||
|
||||
|
||||
void GChanges::onAccept()
|
||||
{
|
||||
if (controller().accept()) {
|
||||
promptChange();
|
||||
} else {
|
||||
promptDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GChanges::onReject()
|
||||
{
|
||||
if (controller().reject()) {
|
||||
promptChange();
|
||||
} else {
|
||||
promptDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GChanges::onNext()
|
||||
{
|
||||
if (controller().find()) {
|
||||
promptChange();
|
||||
} else {
|
||||
promptDismiss();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GChanges::promptChange()
|
||||
{
|
||||
string const header = _("Accept highlighted change?");
|
||||
string const author = controller().getChangeAuthor();
|
||||
string const date = controller().getChangeDate();
|
||||
if(author.empty())
|
||||
author = _("unknown author");
|
||||
if(date.empty())
|
||||
date = _("unknown date");
|
||||
|
||||
messagelabel_->set_markup("<big><b>" + header +
|
||||
"</b></big>\n\nChanged by <b>" + author
|
||||
+ "</b> on <b>" + date + "</b>");
|
||||
|
||||
acceptbutton_->set_sensitive(true && !readOnly());
|
||||
rejectbutton_->set_sensitive(true && !readOnly());
|
||||
nextbutton_->set_sensitive(true);
|
||||
}
|
||||
|
||||
|
||||
void GChanges::promptDismiss()
|
||||
{
|
||||
string const header = _("Done merging changes");
|
||||
|
||||
messagelabel_->set_markup("<big><b>" + header +
|
||||
"</b></big>");
|
||||
|
||||
// Disable all buttons but close.
|
||||
acceptbutton_->set_sensitive(false);
|
||||
rejectbutton_->set_sensitive(false);
|
||||
nextbutton_->set_sensitive(false);
|
||||
}
|
||||
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
54
src/frontends/gtk/GChanges.h
Normal file
54
src/frontends/gtk/GChanges.h
Normal file
@ -0,0 +1,54 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file GChanges.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Spray
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef GCHANGES_H
|
||||
#define GCHANGES_H
|
||||
|
||||
#include "GViewBase.h"
|
||||
|
||||
namespace lyx {
|
||||
namespace frontend {
|
||||
|
||||
class ControlChanges;
|
||||
|
||||
/**
|
||||
* This class provides a GTK+ implementation of the Merge Changes Dialog.
|
||||
*/
|
||||
class GChanges
|
||||
: public GViewCB<ControlChanges, GViewGladeB> {
|
||||
public:
|
||||
GChanges(Dialog &);
|
||||
|
||||
private:
|
||||
/// not needed.
|
||||
virtual void apply() {}
|
||||
/// Build the dialog
|
||||
virtual void doBuild();
|
||||
/// update the dialog
|
||||
virtual void update();
|
||||
|
||||
void onAccept();
|
||||
void onReject();
|
||||
void onNext();
|
||||
|
||||
void promptChange();
|
||||
void promptDismiss();
|
||||
|
||||
Gtk::Label * messagelabel_;
|
||||
Gtk::Button * nextbutton_;
|
||||
Gtk::Button * acceptbutton_;
|
||||
Gtk::Button * rejectbutton_;
|
||||
};
|
||||
|
||||
} // namespace frontend
|
||||
} // namespace lyx
|
||||
|
||||
#endif // GCHANGES_H
|
@ -24,6 +24,8 @@ libgtk_la_SOURCES = \
|
||||
GAboutlyx.h \
|
||||
GBC.C \
|
||||
GBC.h \
|
||||
GChanges.C \
|
||||
GChanges.h \
|
||||
GCharacter.C \
|
||||
GCharacter.h \
|
||||
GErrorList.C \
|
||||
@ -107,7 +109,6 @@ xforms_objects = \
|
||||
../xforms/FormBox.lo \
|
||||
../xforms/FormBranch.lo \
|
||||
../xforms/FormBrowser.lo \
|
||||
../xforms/FormChanges.lo \
|
||||
../xforms/FormCitation.lo \
|
||||
../xforms/FormColorpicker.lo \
|
||||
../xforms/FormDialogView.lo \
|
||||
|
352
src/frontends/gtk/glade/changes.glade
Normal file
352
src/frontends/gtk/glade/changes.glade
Normal file
@ -0,0 +1,352 @@
|
||||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
|
||||
<widget class="GtkDialog" id="dialog">
|
||||
<property name="border_width">6</property>
|
||||
<property name="title" translatable="yes">dialog1</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="has_separator">False</property>
|
||||
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="Close">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Abort merge</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-close</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="response_id">-7</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="Next">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Ignore this change and proceed to the next</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="response_id">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment8">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">0</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox13">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">2</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image10">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-go-forward</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label14">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Next</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="Reject">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Reject this change</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="response_id">-6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment4">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">0</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox7">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">2</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image4">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-no</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label8">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Reject</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="Accept">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Accept the change highlighted in the main window</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="response_id">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment5">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">0</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox10">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">2</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image7">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-yes</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label11">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Accept</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox9">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image6">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-dialog-question</property>
|
||||
<property name="icon_size">6</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">6</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="Message">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b><big>Accept highlighted change?</big></b>
|
||||
|
||||
Changed by <b>A Person</b> on <b>4th July</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">4</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
Loading…
Reference in New Issue
Block a user