[latexila/gnome-3: 45/45] Merge branch 'master' into gnome-3
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila/gnome-3: 45/45] Merge branch 'master' into gnome-3
- Date: Sun, 5 Feb 2012 11:51:50 +0000 (UTC)
commit 283ce9967f97104e3fb6602375e47ee198832df8
Merge: a5ebf88 cb91bd2
Author: SÃbastien Wilmet <swilmet src gnome org>
Date: Sun Feb 5 12:48:10 2012 +0100
Merge branch 'master' into gnome-3
Conflicts:
TODO
src/completion.vala
src/main.vala
src/main_window.vala
src/search.vala
AUTHORS | 1 +
CMakeLists.txt | 6 +-
INSTALL | 2 +-
NEWS | 14 +
README | 2 +-
TODO | 63 +-
data/completion.xml | 173 +++-
help/de/de.po | 207 +++-
po/LINGUAS | 3 +
po/POTFILES.in | 2 +-
po/eo.po | 2010 +++++++++++++++++++++++++++++
po/es.po | 75 +-
po/fr.po | 194 ++--
po/nb.po | 2083 +++++++++++++++++++++++++++++++
po/sv.po | 627 +++++-----
po/zh_CN.po | 2019 ++++++++++++++++++++++++++++++
src/app_settings.vala | 18 +-
src/build_tools.vala | 6 +-
src/completion.vala | 1156 +++++++++--------
src/document.vala | 26 +-
src/document_structure.vala | 30 +-
src/latex_menu.vala | 53 +-
src/latex_post_processor.vala | 2 +-
src/{application.vala => latexila.vala} | 15 +-
src/main.vala | 6 +-
src/main_window.vala | 32 +-
src/most_used_symbols.vala | 4 +-
src/projects.vala | 14 +-
src/search.vala | 2 +-
src/structure.vala | 4 +-
src/templates.vala | 8 +-
src/ui/ui.xml | 44 +-
src/utils.vala | 4 +-
33 files changed, 7735 insertions(+), 1170 deletions(-)
---
diff --cc TODO
index c47a173,81eaf64..91e0ef3
--- a/TODO
+++ b/TODO
@@@ -6,25 -9,37 +9,44 @@@ The TODO is more detailed, but focus mo
LaTeXila 2.4
============
- - Migrate to GTK+ 3.2, GtkSourceView 3, etc:
+ - Possibility to compile an unsaved LaTeX file, to test easily some code without
+ the need to save it in a temporary file that we have to delete just after the test,
+ and that we don't delete anyway.
+
+ The unsaved file would simply be saved somewhere in /tmp/.
+
+ - Improve completion:
+ - complete placeholders (\ref, \cite, ...)
+ (take into account all *.tex, *.bib, ... files of the project)
+
-
+ LaTeXila â 2.4
+ ==============
+
+ - Migrate to GTK+ 3 [in progress]
+ - It's not a high priority, since it's not a big issue for GNOME 3 users,
+ but it would be nice. The problem is that it involves a lot of work,
+ more than expected. See the branch gnome-3.
+
+ - GtkBox -> GtkGrid
+ - right click on document tab (the gray zone is ugly)
+ - remove the border of toolbars
+ - reduce some widgets sizes (some are too big)
+ - use GtkApplication instead of Unique
+ - test dev version of GtkSpell
+ - replace gtk_source_completion_info_set_sizing()
+
- LaTeXila â 2.4
- ==============
+ - Improve completion:
+ - show details by default (now we have to click on the button to see
+ the details)
- - Completion:
- - show details by default
- - complete placeholders (\ref, \cite, ...)
- (take into account all *.tex, *.bib, ... files of the project)
- - Insert an image easily. Instead of a wizzard, the approach is to have very good
- completion of \begin{figure}[here], \includegraphics[here]{and here}, and automatically
- complete the label with the filename of the image.
+ - Insert an image easily. Instead of a wizzard, the approach is to:
+ - have very good completion of:
+ - \begin{figure}[here]
+ - \includegraphics[here]{and here}
+ - automatically complete the label with the filename of the image
+
+ A big disadvantage of a wizzard is: how to modify easily the image afterwards?
+ Generally, in this case, the user deletes the LaTeX code and re-run the wizzardâ
(-) Structure:
- Select the current section or item when the document cursor moves
diff --cc src/completion.vala
index 05abea6,f89aa17..b927cc6
--- a/src/completion.vala
+++ b/src/completion.vala
@@@ -258,22 -298,66 +298,66 @@@ public class CompletionProvider : GLib.
filtered_proposals.prepend (dummy_proposal);
}
- // Since we have prepend items we must reverse the list to keep the proposals
- // in ascending order.
- // FIXME maybe it's better to sort the proposals in descending order so when
- // we prepend items it's in ascending order and we avoid reversing the list each
- // time. But when we have to display all proposals (see above) it takes more time,
- // but generally that occurs less often unless the minimum number of chars for
- // interactive completion is 0.
- else
- filtered_proposals.reverse ();
+ context.add_proposals ((SourceCompletionProvider) this, filtered_proposals, true);
+ }
+
+ /*************************************************************************/
+ // Calltip: completion information, but without proposals
+
+ private void init_calltip_window ()
+ {
+ Latexila app = Latexila.get_default ();
+ _calltip_window = new SourceCompletionInfo ();
+ _calltip_window.set_transient_for (app.active_window);
- _calltip_window.set_sizing (800, 200, true, true);
++// _calltip_window.set_sizing (800, 200, true, true);
+ _calltip_window_label = new Label (null);
+ _calltip_window.set_widget (_calltip_window_label);
+ }
+
+ // Show the LaTeX command prototype, with the current argument in bold.
+ private void show_calltip_cmd_prototype (string arg_cmd,
+ Gee.ArrayList<bool> arguments)
+ {
+ return_if_fail (_commands.has_key (arg_cmd));
+
+ CompletionCommand command = _commands[arg_cmd];
+ int arg_num = get_argument_num (command.args, arguments);
+ if (arg_num != -1)
+ {
+ string info = get_command_info (command, arg_num);
+ show_calltip_info (info);
+ }
+ }
+
+ private void show_calltip_info (string markup)
+ {
+ if (_calltip_window == null)
+ init_calltip_window ();
+
+ _calltip_window_label.set_markup (markup);
+
+ MainWindow window = Latexila.get_default ().active_window;
+ _calltip_window.set_transient_for (window);
- context.add_proposals ((SourceCompletionProvider) this, filtered_proposals,
- true);
+ // Calltip at a fixed place (after the '{' or '[' of the current argument).
+ TextIter cursor_pos;
+ TextBuffer buffer = window.active_view.buffer;
+ buffer.get_iter_at_mark (out cursor_pos, buffer.get_insert ());
+ TextIter begin_arg_pos = get_begin_arg_pos (cursor_pos);
+ _calltip_window.move_to_iter (window.active_view, begin_arg_pos);
- first_populate = false;
+ _calltip_window.show_all ();
}
+ public void hide_calltip_window ()
+ {
+ if (_calltip_window != null)
+ _calltip_window.hide ();
+ }
+
+ /*************************************************************************/
+ // Activate a proposal: the user has e.g. pressed Enter on a proposal.
+
public bool activate_proposal (SourceCompletionProposal proposal, TextIter iter)
{
string text = proposal.get_text ();
diff --cc src/main.vala
index ab93a77,1db53f4..7972328
--- a/src/main.vala
+++ b/src/main.vala
@@@ -93,80 -93,83 +93,80 @@@ int main (string[] args
}
/* prepare commands */
- bool command_open = false;
- Unique.MessageData data = new Unique.MessageData ();
+// bool command_open = false;
+// Unique.MessageData data = new Unique.MessageData ();
+//
+// if (remaining_args.length != 0)
+// {
+// command_open = true;
+//
+// // since remaining_args.length == 0, we use a dynamic array
+// string[] uris = {};
+// foreach (string arg in remaining_args)
+// // The command line argument can be absolute or relative.
+// // With URI's, that's always absolute, so no problem.
+// uris += File.new_for_path (arg).get_uri ();
+//
+// data.set_uris (uris);
+// }
+//
+// Unique.App app = new Unique.App ("org.gnome.latexila", null);
- // app.add_command ("new_window", Application.NEW_WINDOW);
++// app.add_command ("new_window", Latexila.NEW_WINDOW);
+//
+// if (app.is_running)
+// {
+// /* send commands */
+// bool ok = true;
+// if (option_new_window)
+// {
- // Unique.Response resp = app.send_message (Application.NEW_WINDOW, null);
++// Unique.Response resp = app.send_message (Latexila.NEW_WINDOW, null);
+// ok = resp == Unique.Response.OK;
+// }
+// if (ok && command_open)
+// {
+// Unique.Response resp = app.send_message (Unique.Command.OPEN, data);
+// ok = resp == Unique.Response.OK;
+// }
+// if (ok && option_new_document)
+// {
+// Unique.Response resp = app.send_message (Unique.Command.NEW, null);
+// ok = resp == Unique.Response.OK;
+// }
+// if (! option_new_window && ! command_open && ! option_new_document)
+// {
+// Unique.Response resp = app.send_message (Unique.Command.ACTIVATE, null);
+// ok = resp == Unique.Response.OK;
+// }
+//
+// if (! ok)
+// error ("Error: communication with first instance of LaTeXila failed\n");
+// return 0;
+// }
- if (remaining_args.length != 0)
- {
- command_open = true;
+ /* start a new application */
- Application latexila = Application.get_default ();
++ Latexila latexila = Latexila.get_default ();
- // since remaining_args.length == 0, we use a dynamic array
- string[] uris = {};
- foreach (string arg in remaining_args)
- // The command line argument can be absolute or relative.
- // With URI's, that's always absolute, so no problem.
- uris += File.new_for_path (arg).get_uri ();
+ /* reopen files on startup */
+ GLib.Settings editor_settings =
+ new GLib.Settings ("org.gnome.latexila.preferences.editor");
+ if (editor_settings.get_boolean ("reopen-files"))
+ {
+ GLib.Settings window_settings =
+ new GLib.Settings ("org.gnome.latexila.state.window");
- data.set_uris (uris);
+ string[] uris = window_settings.get_strv ("documents");
+ latexila.open_documents (uris);
}
- Unique.App app = new Unique.App ("org.gnome.latexila", null);
- app.add_command ("new_window", Latexila.NEW_WINDOW);
-
- if (app.is_running)
- {
- /* send commands */
- bool ok = true;
- if (option_new_window)
- {
- Unique.Response resp = app.send_message (Latexila.NEW_WINDOW, null);
- ok = resp == Unique.Response.OK;
- }
- if (ok && command_open)
- {
- Unique.Response resp = app.send_message (Unique.Command.OPEN, data);
- ok = resp == Unique.Response.OK;
- }
- if (ok && option_new_document)
- {
- Unique.Response resp = app.send_message (Unique.Command.NEW, null);
- ok = resp == Unique.Response.OK;
- }
- if (! option_new_window && ! command_open && ! option_new_document)
- {
- Unique.Response resp = app.send_message (Unique.Command.ACTIVATE, null);
- ok = resp == Unique.Response.OK;
- }
-
- if (! ok)
- error ("Error: communication with first instance of LaTeXila failed\n");
- return 0;
- }
+ /* execute commands */
+ // the --new-window option have no effect in this case
+// if (command_open)
+// latexila.open_documents (data.get_uris ());
+ if (option_new_document)
+ latexila.create_document ();
- /* start a new application */
- else
- {
- Latexila latexila = Latexila.get_default ();
-
- /* reopen files on startup */
- GLib.Settings editor_settings =
- new GLib.Settings ("org.gnome.latexila.preferences.editor");
- if (editor_settings.get_boolean ("reopen-files"))
- {
- GLib.Settings window_settings =
- new GLib.Settings ("org.gnome.latexila.state.window");
-
- string[] uris = window_settings.get_strv ("documents");
- latexila.open_documents (uris);
- }
-
- /* execute commands */
- // the --new-window option have no effect in this case
- if (command_open)
- latexila.open_documents (data.get_uris ());
- if (option_new_document)
- latexila.create_document ();
-
- app.message_received.connect (latexila.message);
- Gtk.main ();
- }
+// app.message_received.connect (latexila.message);
+ Gtk.main ();
return 0;
}
diff --cc src/main_window.vala
index 340a8cc,797b83c..4898172
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@@ -590,15 -596,15 +600,15 @@@ public class MainWindow : Windo
update_build_tools_menu ();
}
- private void on_menu_item_select (MenuItem proxy)
- private void on_menu_item_select (Item proxy)
++ private void on_menu_item_select (Gtk.MenuItem proxy)
{
- Gtk.Action action = ((Gtk.MenuItem) proxy).get_related_action ();
+ Gtk.Action action = proxy.get_related_action ();
return_if_fail (action != null);
if (action.tooltip != null)
statusbar.push (tip_message_cid, action.tooltip);
}
- private void on_menu_item_deselect (MenuItem proxy)
- private void on_menu_item_deselect (Item proxy)
++ private void on_menu_item_deselect (Gtk.MenuItem proxy)
{
statusbar.pop (tip_message_cid);
}
diff --cc src/search.vala
index 2c3707b,30a2976..4bebbc5
--- a/src/search.vala
+++ b/src/search.vala
@@@ -136,252 -126,172 +136,252 @@@ public class SearchAndReplace : GLib.Ob
public SearchAndReplace (MainWindow main_window)
{
- this.main_window = main_window;
+ _main_window = main_window;
+
+ _main_grid = new Grid ();
+
+ /* Arrow */
+ _button_arrow = new Button ();
+ _arrow = new Arrow (ArrowType.DOWN, ShadowType.OUT);
+ _button_arrow.add (_arrow);
+ _main_grid.attach (_button_arrow, 0, 0, 1, 1);
+
+ /* Find entry */
+ Frame frame_find = get_find_entry ();
+ _main_grid.attach (frame_find, 1, 0, 1, 1);
+
+ /* Buttons at the right of the find entry */
+ Button button_clear_find = get_button (Stock.CLEAR);
+ Button button_previous = get_button (Stock.GO_UP);
+ Button button_next = get_button (Stock.GO_DOWN);
+ Button button_close = get_button (Stock.CLOSE);
+
+ _main_grid.attach (button_clear_find, 2, 0, 1, 1);
+ _main_grid.attach (button_previous, 3, 0, 1, 1);
+ _main_grid.attach (button_next, 4, 0, 1, 1);
+ _main_grid.attach (button_close, 5, 0, 1, 1);
- string path = Path.build_filename (Config.DATA_DIR, "ui",
- "search_and_replace.ui");
+ /* Replace entry */
+ _replace_grid = new Grid ();
+ _replace_grid.set_orientation (Orientation.HORIZONTAL);
+ _main_grid.attach (_replace_grid, 1, 1, 5, 1);
- try
+ Frame frame_replace = new Frame (null);
+ frame_replace.width_request = 350;
+
+ _entry_replace = new Entry ();
+ _entry_replace.has_frame = false;
+ _entry_replace.set_tooltip_text (_("Replace with"));
+ _entry_replace.can_focus = true;
+
+ frame_replace.add (_entry_replace);
+ _replace_grid.add (frame_replace);
+
+ /* Buttons at the right of the replace entry */
+ Button button_clear_replace = get_button (Stock.CLEAR);
+ Button button_replace = get_button (Stock.FIND_AND_REPLACE);
+
+ // replace all: image + label
+ Button button_replace_all = new Button ();
+ Grid replace_all_grid = new Grid ();
+ replace_all_grid.set_orientation (Orientation.HORIZONTAL);
+ replace_all_grid.set_column_spacing (8);
+
+ Image image = new Image.from_stock (Stock.FIND_AND_REPLACE, IconSize.MENU);
+ replace_all_grid.add (image);
+
+ Label label = new Label (_("All"));
+ replace_all_grid.add (label);
+ button_replace_all.add (replace_all_grid);
+
+ _replace_grid.add (button_clear_replace);
+ _replace_grid.add (button_replace);
+ _replace_grid.add (button_replace_all);
+
+ /* signal handlers */
+
+ _button_arrow.clicked.connect (() =>
{
- Builder builder = new Builder ();
- builder.add_from_file (path);
-
- /* get objects */
- widget = (Widget) builder.get_object ("search_and_replace");
- // we unparent the main widget because the ui file contains a window
- widget.unparent ();
-
- button_arrow = (Button) builder.get_object ("button_arrow");
- arrow = (Arrow) builder.get_object ("arrow");
-
- entry_find = (Entry) builder.get_object ("entry_find");
- label_find_normal = (Label) builder.get_object ("label_find_normal");
- label_find_error = (Label) builder.get_object ("label_find_error");
- EventBox eventbox_label1 = (EventBox) builder.get_object ("eventbox_label1");
- EventBox eventbox_label2 = (EventBox) builder.get_object ("eventbox_label2");
- Button button_clear_find = (Button) builder.get_object ("button_clear_find");
-
- entry_replace = (Entry) builder.get_object ("entry_replace");
- frame_replace = (Frame) builder.get_object ("frame_replace");
- Button button_clear_replace =
- (Button) builder.get_object ("button_clear_replace");
- Button button_replace = (Button) builder.get_object ("button_replace");
- Button button_replace_all =
- (Button) builder.get_object ("button_replace_all");
-
- hbox_replace = (HBox) builder.get_object ("hbox_replace");
-
- Button button_previous = (Button) builder.get_object ("button_previous");
- Button button_next = (Button) builder.get_object ("button_next");
-
- Button button_close = (Button) builder.get_object ("button_close");
-
- /* styles */
- Gdk.Color white;
- Gdk.Color.parse ("white", out white);
- eventbox_label1.modify_bg (StateType.NORMAL, white);
- eventbox_label2.modify_bg (StateType.NORMAL, white);
-
- /* options menu */
- Gtk.Menu menu = new Gtk.Menu ();
- check_case_sensitive = new CheckMenuItem.with_label (_("Case sensitive"));
- check_entire_word = new CheckMenuItem.with_label (_("Entire words only"));
- menu.append (check_case_sensitive);
- menu.append (check_entire_word);
- menu.show_all ();
-
- /* signal handlers */
-
- entry_find.icon_press.connect ((icon_pos, event) =>
+ // search and replace -> search
+ if (get_mode () == Mode.SEARCH_AND_REPLACE)
{
- // options menu
- if (icon_pos == EntryIconPosition.PRIMARY)
- menu.popup (null, null, null, event.button.button, event.button.time);
- });
+ _arrow.arrow_type = ArrowType.DOWN;
+ _replace_grid.hide ();
+ }
- button_arrow.clicked.connect (() =>
- {
- // search and replace -> search
- if (search_and_replace_mode)
- {
- arrow.arrow_type = ArrowType.DOWN;
- frame_replace.hide ();
- hbox_replace.hide ();
- }
-
- // search -> search and replace
- else
- {
- arrow.arrow_type = ArrowType.UP;
- frame_replace.show ();
- hbox_replace.show ();
- }
- });
-
- button_close.clicked.connect (hide);
-
- button_clear_find.clicked.connect (() => entry_find.text = "");
- button_clear_replace.clicked.connect (() => entry_replace.text = "");
-
- button_previous.clicked.connect (() =>
+ // search -> search and replace
+ else
{
- set_search_text (false);
- return_if_fail (working_document != null);
- working_document.search_backward ();
- });
+ _arrow.arrow_type = ArrowType.UP;
+ _replace_grid.show ();
+ }
+ });
- button_next.clicked.connect (search_forward);
- entry_find.activate.connect (search_forward);
+ button_close.clicked.connect (hide);
- entry_find.changed.connect (() =>
- {
- bool sensitive = entry_find.text_length > 0;
- button_clear_find.sensitive = sensitive;
- button_previous.sensitive = sensitive;
- button_next.sensitive = sensitive;
- button_replace.sensitive = sensitive;
- button_replace_all.sensitive = sensitive;
-
- if (entry_find.text_length == 0)
- {
- label_find_normal.hide ();
- label_find_error.hide ();
- clear_search ();
- }
- else if (entry_find.text_length >= min_nb_chars_for_incremental_search)
- set_search_text ();
- });
-
- entry_replace.changed.connect (() =>
- {
- button_clear_replace.sensitive = entry_replace.text_length > 0;
- });
+ button_clear_find.clicked.connect (() => _entry_find.text = "");
+ button_clear_replace.clicked.connect (() => _entry_replace.text = "");
- check_case_sensitive.toggled.connect (() => set_search_text ());
- check_entire_word.toggled.connect (() => set_search_text ());
+ button_previous.clicked.connect (() =>
+ {
+ set_search_text (false);
+ return_if_fail (_working_document != null);
+ _working_document.search_backward ();
+ });
- button_replace.clicked.connect (replace);
- entry_replace.activate.connect (replace);
+ button_next.clicked.connect (search_forward);
+ _entry_find.activate.connect (search_forward);
- button_replace_all.clicked.connect (() =>
+ _entry_find.changed.connect (() =>
+ {
+ bool sensitive = _entry_find.text_length > 0;
+ button_clear_find.sensitive = sensitive;
+ button_previous.sensitive = sensitive;
+ button_next.sensitive = sensitive;
+ button_replace.sensitive = sensitive;
+ button_replace_all.sensitive = sensitive;
+
+ if (_entry_find.text_length == 0)
{
- return_if_fail (entry_find.text_length != 0);
+ _label_find_normal.hide ();
+ _label_find_error.hide ();
+ clear_search ();
+ }
+ else if (_entry_find.text_length >= min_nb_chars_for_incremental_search)
set_search_text ();
- working_document.replace_all (entry_replace.text);
- });
+ });
+
+ _entry_replace.changed.connect (() =>
+ {
+ button_clear_replace.sensitive = _entry_replace.text_length > 0;
+ });
+
+ _check_case_sensitive.toggled.connect (() => set_search_text ());
+ _check_entire_word.toggled.connect (() => set_search_text ());
+
+ button_replace.clicked.connect (replace);
+ _entry_replace.activate.connect (replace);
+
+ button_replace_all.clicked.connect (() =>
+ {
+ return_if_fail (_entry_find.text_length != 0);
+ set_search_text ();
+ _working_document.replace_all (_entry_replace.text);
+ });
- entry_find.key_press_event.connect ((event) =>
+ _entry_find.key_press_event.connect ((event) =>
+ {
+ // See GDK_KEY_* in gdk/gdkkeysyms.h (not available in Vala)
+ switch (event.keyval)
{
- // See GDK_KEY_* in gdk/gdkkeysyms.h (not available in Vala)
- switch (event.keyval)
- {
- case 0xff09: // GDK_KEY_Tab
- // TAB in find => go to replace
- show_search_and_replace ();
- entry_replace.grab_focus ();
- return true;
-
- case 0xff1b: // GDK_KEY_Escape
- // Escape in find => select text and hide search
- select_selected_search_text ();
- hide ();
- return true;
-
- default:
- // propagate the event further
- return false;
- }
- });
- }
- catch (Error e)
+ case 0xff09: // GDK_KEY_Tab
+ // TAB in find => go to replace
+ show_search_and_replace ();
+ _entry_replace.grab_focus ();
+ return true;
+
+ case 0xff1b: // GDK_KEY_Escape
+ // Escape in find => select text and hide search
+ select_selected_search_text ();
+ hide ();
+ return true;
+
+ default:
+ // propagate the event further
+ return false;
+ }
+ });
+
+ _main_grid.hide ();
+ }
+
+ /* Find entry, with two labels for displaying some information */
+ private Frame get_find_entry ()
+ {
+ Frame frame_find = new Frame (null);
+ frame_find.shadow_type = ShadowType.IN;
+ frame_find.width_request = 350;
+
+ Grid grid_find = new Grid ();
+ grid_find.set_orientation (Orientation.HORIZONTAL);
+
+ /* Entry */
+ _entry_find = new Entry ();
+ _entry_find.set_has_frame (false);
+ _entry_find.primary_icon_stock = Stock.PROPERTIES;
+ _entry_find.primary_icon_activatable = true;
+ _entry_find.set_tooltip_text (_("Search for"));
+ _entry_find.can_focus = true;
+ grid_find.add (_entry_find);
+
+ /* "Normal" information (number of matches, etc.) */
+ EventBox eventbox_normal = new EventBox ();
+ _label_find_normal = new Label (null);
+
+ Pango.AttrList attributes = new Pango.AttrList ();
+
+ // foreground: light gray (#AAAA AAAA AAAA)
+ Pango.Attribute attr_foreground = Pango.attr_foreground_new (43690, 43690, 43690);
+ attributes.insert ((owned) attr_foreground);
+
+ // background: white
+ Pango.Attribute attr_background = Pango.attr_background_new (65535, 65535, 65535);
+ attributes.insert ((owned) attr_background);
+
+ _label_find_normal.set_attributes (attributes);
+ eventbox_normal.add (_label_find_normal);
+ grid_find.add (eventbox_normal);
+
+ /* "Error" information (text not found, etc.) */
+ EventBox eventbox_error = new EventBox ();
+ _label_find_error = new Label (null);
+
+ attributes = new Pango.AttrList ();
+
+ // foreground: white
+ attr_foreground = Pango.attr_foreground_new (65535, 65535, 65535);
+ attributes.insert ((owned) attr_foreground);
+
+ // background: red (#CCCC 0000 0000)
+ attr_background = Pango.attr_background_new (52428, 0, 0);
+ attributes.insert ((owned) attr_background);
+
+ _label_find_error.set_attributes (attributes);
+ eventbox_error.add (_label_find_error);
+ grid_find.add (eventbox_error);
+
+ // eventboxes style
+ Gdk.Color white;
+ Gdk.Color.parse ("white", out white);
+ eventbox_normal.modify_bg (StateType.NORMAL, white);
+ eventbox_error.modify_bg (StateType.NORMAL, white);
+
+ frame_find.add (grid_find);
+
+ /* Options menu */
- Menu menu = new Menu ();
++ Gtk.Menu menu = new Gtk.Menu ();
+ _check_case_sensitive = new CheckMenuItem.with_label (_("Case sensitive"));
+ _check_entire_word = new CheckMenuItem.with_label (_("Entire words only"));
+ menu.append (_check_case_sensitive);
+ menu.append (_check_entire_word);
+ menu.show_all ();
+
+ _entry_find.icon_press.connect ((icon_pos, event) =>
{
- warning ("Search and replace: %s", e.message);
- Label label = new Label (e.message);
- label.set_line_wrap (true);
- widget = label;
- }
+ // options menu
+ if (icon_pos == EntryIconPosition.PRIMARY)
+ menu.popup (null, null, null, event.button.button, event.button.time);
+ });
- widget.hide ();
+ return frame_find;
+ }
+
+ private Button get_button (string stock_id)
+ {
+ Button button = new Button ();
+ Image image = new Image.from_stock (stock_id, IconSize.MENU);
+ button.add (image);
+ return button;
}
public Widget get_widget ()
diff --cc src/structure.vala
index 7a38acc,8004319..8f1ae69
--- a/src/structure.vala
+++ b/src/structure.vala
@@@ -55,10 -55,10 +55,10 @@@ public enum StructActio
NB_ACTIONS
}
-public class Structure : VBox
+public class Structure : Grid
{
private unowned MainWindow _main_window;
- private Menu _popup_menu;
+ private Gtk.Menu _popup_menu;
private Gtk.Action _action_all_menu;
private Gtk.Action _action_cut;
private Gtk.Action _action_copy;
@@@ -89,11 -89,10 +89,11 @@@
public Structure (MainWindow main_window, UIManager ui_manager)
{
- GLib.Object (spacing: 3);
+ orientation = Orientation.VERTICAL;
+ row_spacing = 3;
_main_window = main_window;
- _popup_menu = (Menu) ui_manager.get_widget ("/StructurePopup");
+ _popup_menu = ui_manager.get_widget ("/StructurePopup") as Gtk.Menu;
_action_all_menu = ui_manager.get_action ("/MainMenu/Structure");
_action_cut = ui_manager.get_action ("/StructurePopup/StructureCut");
_action_copy = ui_manager.get_action ("/StructurePopup/StructureCopy");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]