Commit 71d3d29b authored by Paolo Maggi's avatar Paolo Maggi Committed by Paolo Maggi

Added Page Setup menu item and dialog

2003-06-12  Paolo Maggi <paolo.maggi@polito.it>

	Added Page Setup menu item and dialog

	* dialogs/page-setup-dialog.glade2:
	* dialogs/gedit-page-setup-dialog.[ch]: new files

	* dialogs/Makefile.am: compile the new files

	* dialogs/gedit-dialog-goto-line.c (dialog_goto_line_get_dialog):
	fix a mem leak

	* dialogs/gnome-print-font-picker.c: fix a mem leak

	* gedit-commands.[ch] (gedit_cmd_file_page_setup): new function,
	shows the page setup dialog

	* gedit-menus.c: added FilePageSetup to gedit_verbs

	* gedit-prefs-manager.[ch] (gedit_prefs_manager_get_print_syntax_hl)
	(gedit_prefs_manager_set_print_syntax_hl)
	(gedit_prefs_manager_print_syntax_hl_can_set): new functions

	* gedit-print.c (gedit_print_job_info_new): print syntax highlighting
	only if gedit_prefs_manager_get_print_syntax_hl returns TRUE.
	Mark "Page %N of %Q" string for translation.

	* gedit-ui.xml: added the File->Page Setup menu item

	* gedit-utils.[ch] (gedit_warning): new function, displays an error
	message	box

2002-06-12  Paolo Maggi <paolo.maggi@polito.it>

	* data/gedit.schemas.in: added
	preferences/print/page/print_syntax_highlighting key

	* configure.in: updated dependences, set GETTEXT_PACKAGE to gedit-2.4
parent f6809661
2002-06-12 Paolo Maggi <paolo.maggi@polito.it>
* data/gedit.schemas.in: added
preferences/print/page/print_syntax_highlighting key
* configure.in: updated dependences, set GETTEXT_PACKAGE to gedit-2.4
2002-06-06 Paolo Maggi <paolo.maggi@polito.it>
* data/gedit.schemas.in: removed preferences/editor/load/encodings key,
......
......@@ -14,7 +14,7 @@ AM_CONFIG_HEADER(config.h)
AM_DISABLE_STATIC
AC_PATH_PROG(GCONFTOOL, gconftool-2)
AC_PROG_INTLTOOL([0.22])
AC_PROG_INTLTOOL([0.25])
AM_PROG_LIBTOOL
......@@ -27,7 +27,7 @@ AC_PROG_MAKE_SET
dnl ================================================================
dnl Gettext stuff.
dnl ================================================================
GETTEXT_PACKAGE=gedit-2.0
GETTEXT_PACKAGE=gedit-2.4
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
ALL_LINGUAS="am ar be bg az ca cs cy da de el es et eu fa fi fr ga gl he hi hu it ja kn ko lt lv mk ml mn ms nl nn no pl pt pt_BR ro ru sv sk sl sr sr@Latn ta th tr uk vi wa zh_CN zh_TW"
......@@ -70,8 +70,8 @@ dnl
dnl Start of pkg-config checks
dnl
PKG_CHECK_MODULES(GEDIT, libgnomeui-2.0 >= 2.2.0 libglade-2.0 >= 2.0.0
libgnomeprintui-2.2 >= 2.2.0
eel-2.0 >= 2.2.0 gtksourceview-1.0 >= 0.2.1)
eel-2.0 >= 2.2.0 gtksourceview-1.0 >= 0.3.0
libgnomeprintui-2.2 >= 2.2.0)
GEDIT_LIBS="${GEDIT_LIBS}"
AC_SUBST(GEDIT_LIBS)
AC_SUBST(GEDIT_CFLAGS)
......
......@@ -304,6 +304,19 @@
</locale>
</schema>
<schema>
<key>/schemas/apps/gedit-2/preferences/print/page/print_syntax_highlighting</key>
<applyto>/apps/gedit-2/preferences/print/page/print_syntax_highlighting</applyto>
<owner>gedit</owner>
<type>bool</type>
<default>TRUE</default>
<locale name="C">
<short>Print Syntax Highlighting</short>
<long>Whether gedit should print syntax highlighting when
printing documents.</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gedit-2/preferences/print/page/print_header</key>
<applyto>/apps/gedit-2/preferences/print/page/print_header</applyto>
......@@ -322,7 +335,7 @@
<applyto>/apps/gedit-2/preferences/print/page/print_wrap_mode</applyto>
<owner>gedit</owner>
<type>string</type>
<default>GTK_WRAP_CHAR</default>
<default>GTK_WRAP_WORD</default>
<locale name="C">
<short>Printing Line Wrapping Mode</short>
<long>Specifies how to wrap long lines for printing. Use
......
2003-06-12 Paolo Maggi <paolo.maggi@polito.it>
Added Page Setup menu item and dialog
* dialogs/page-setup-dialog.glade2:
* dialogs/gedit-page-setup-dialog.[ch]: new files
* dialogs/Makefile.am: compile the new files
* dialogs/gedit-dialog-goto-line.c (dialog_goto_line_get_dialog):
fix a mem leak
* dialogs/gnome-print-font-picker.c: fix a mem leak
* gedit-commands.[ch] (gedit_cmd_file_page_setup): new function,
shows the page setup dialog
* gedit-menus.c: added FilePageSetup to gedit_verbs
* gedit-prefs-manager.[ch] (gedit_prefs_manager_get_print_syntax_hl)
(gedit_prefs_manager_set_print_syntax_hl)
(gedit_prefs_manager_print_syntax_hl_can_set): new functions
* gedit-print.c (gedit_print_job_info_new): print syntax highlighting
only if gedit_prefs_manager_get_print_syntax_hl returns TRUE.
Mark "Page %N of %Q" string for translation.
* gedit-ui.xml: added the File->Page Setup menu item
* gedit-utils.[ch] (gedit_warning): new function, displays an error
message box
2003-06-09 Paolo Maggi <paolo.maggi@polito.it>
* gedit-print.[ch]: rewritten
......
......@@ -30,6 +30,8 @@ libdialogs_la_SOURCES = \
gnome-print-font-dialog.h \
gedit-encodings-dialog.c \
gedit-encodings-dialog.h \
gedit-page-setup-dialog.c \
gedit-page-setup-dialog.h \
gedit-dialogs.h
glade_DATA = \
......@@ -39,7 +41,8 @@ glade_DATA = \
plugin-manager.glade2 \
gedit-preferences.glade2 \
program-location-dialog.glade2 \
gedit-encodings-dialog.glade2
gedit-encodings-dialog.glade2 \
page-setup-dialog.glade2
EXTRA_DIST = $(glade_DATA)
......@@ -187,6 +187,7 @@ dialog_goto_line_get_dialog (void)
_("Could not find the required widgets inside %s."),
"goto-line.glade2");
g_object_unref (gui);
g_free (dialog);
return NULL;
}
......
This diff is collapsed.
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* gedit-page-setup-dialog.c
* This file is part of gedit
*
* Copyright (C) 2003 Paolo Maggi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
* Modified by the gedit Team, 2003. See the AUTHORS file for a
* list of people on the gedit Team.
* See the ChangeLog files for a list of changes.
*/
#ifndef __GEDIT_PAGE_SETUP_DIALOG_H__
#define __GEDIT_PAGE_SETUP_DIALOG_H__
#include <gtk/gtkwindow.h>
void gedit_show_page_setup_dialog (GtkWindow *parent);
#endif /* __GEDIT_PAGE_SETUP_DIALOG_H__ */
......@@ -728,7 +728,7 @@ const gchar* gnome_print_font_picker_get_font_name (GnomePrintFontPicker *
font_sel = gnome_print_font_dialog_get_fontsel (GNOME_PRINT_FONT_DIALOG (gfp->_priv->font_dialog));
font = gnome_font_selection_get_font (GNOME_FONT_SELECTION (font_sel));
gfp->_priv->font_name = g_strdup (gnome_font_get_full_name (font));
gfp->_priv->font_name = gnome_font_get_full_name (font);
gfp->_priv->font = font;
}
......
This diff is collapsed.
......@@ -47,7 +47,7 @@
#include "gedit-print.h"
#include "dialogs/gedit-dialogs.h"
#include "dialogs/gedit-preferences-dialog.h"
#include "dialogs/gedit-page-setup-dialog.h"
void
gedit_cmd_file_new (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname)
......@@ -139,6 +139,17 @@ gedit_cmd_file_open_uri (BonoboUIComponent *uic, gpointer user_data, const gchar
gedit_dialog_open_uri ();
}
void
gedit_cmd_file_page_setup (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname)
{
BonoboWindow *active_window;
active_window = gedit_get_active_window ();
g_return_if_fail (active_window != NULL);
gedit_show_page_setup_dialog (GTK_WINDOW (active_window));
}
void
gedit_cmd_file_print (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname)
{
......
......@@ -40,6 +40,7 @@ void gedit_cmd_file_save_as (BonoboUIComponent *uic, gpointer user_data, con
void gedit_cmd_file_save_all (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname);
void gedit_cmd_file_revert (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname);
void gedit_cmd_file_open_uri (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname);
void gedit_cmd_file_page_setup (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname);
void gedit_cmd_file_print (BonoboUIComponent *uic, gpointer user_data, const gchar* verbname);
void gedit_cmd_file_print_preview
(BonoboUIComponent *uic, gpointer user_data, const gchar* verbname);
......
......@@ -45,6 +45,7 @@ BonoboUIVerb gedit_verbs [] = {
BONOBO_UI_VERB ("FileSaveAll", gedit_cmd_file_save_all),
BONOBO_UI_VERB ("FileRevert", gedit_cmd_file_revert),
BONOBO_UI_VERB ("FileOpenURI", gedit_cmd_file_open_uri),
BONOBO_UI_VERB ("FilePageSetup", gedit_cmd_file_page_setup),
BONOBO_UI_VERB ("FilePrint", gedit_cmd_file_print),
BONOBO_UI_VERB ("FilePrintPreview", gedit_cmd_file_print_preview),
BONOBO_UI_VERB ("FileClose", gedit_cmd_file_close),
......
......@@ -729,6 +729,11 @@ DEFINE_BOOL_PREF (statusbar_visible,
GPM_STATUSBAR_VISIBLE,
GPM_DEFAULT_STATUSBAR_VISIBLE)
/* Print syntax highlighting */
DEFINE_BOOL_PREF (print_syntax_hl,
GPM_PRINT_SYNTAX,
GPM_DEFAULT_PRINT_SYNTAX)
/* Print header */
DEFINE_BOOL_PREF (print_header,
GPM_PRINT_HEADER,
......
......@@ -86,6 +86,7 @@
/* Print */
#define GPM_PRINT_PAGE_DIR GPM_PREFS_DIR "/print/page"
#define GPM_PRINT_SYNTAX GPM_PRINT_PAGE_DIR "/print_syntax_highlighting"
#define GPM_PRINT_HEADER GPM_PRINT_PAGE_DIR "/print_header"
#define GPM_PRINT_WRAP_MODE GPM_PRINT_PAGE_DIR "/print_wrap_mode"
#define GPM_PRINT_LINE_NUMBERS GPM_PRINT_PAGE_DIR "/print_line_numbers"
......@@ -143,8 +144,9 @@
#define GPM_DEFAULT_STATUSBAR_VISIBLE 1 /* TRUE */
#define GPM_DEFAULT_PRINT_SYNTAX 1 /* TRUE */
#define GPM_DEFAULT_PRINT_HEADER 1 /* TRUE */
#define GPM_DEFAULT_PRINT_WRAP_MODE "GTK_WRAP_CHAR"
#define GPM_DEFAULT_PRINT_WRAP_MODE "GTK_WRAP_WORD"
#define GPM_DEFAULT_PRINT_LINE_NUMBERS 0 /* No numbers */
#define GPM_DEFAULT_PRINT_FONT_BODY (const gchar*) "Monospace Regular 9"
......@@ -278,6 +280,11 @@ gboolean gedit_prefs_manager_get_statusbar_visible (void);
void gedit_prefs_manager_set_statusbar_visible (gboolean sv);
gboolean gedit_prefs_manager_statusbar_visible_can_set (void);
/* Print syntax highlighting */
gboolean gedit_prefs_manager_get_print_syntax_hl (void);
void gedit_prefs_manager_set_print_syntax_hl (gboolean ps);
gboolean gedit_prefs_manager_print_syntax_hl_can_set (void);
/* Print header */
gboolean gedit_prefs_manager_get_print_header (void);
void gedit_prefs_manager_set_print_header (gboolean ph);
......
......@@ -526,7 +526,8 @@ gedit_print_job_info_new (GeditDocument* doc)
gnome_print_config_unref (config);
gtk_source_print_job_set_highlight (pjob,
gtk_source_buffer_get_highlight (GTK_SOURCE_BUFFER (doc)));
gtk_source_buffer_get_highlight (GTK_SOURCE_BUFFER (doc)) &&
gedit_prefs_manager_get_print_syntax_hl ());
gtk_source_print_job_set_print_numbers (pjob,
gedit_prefs_manager_get_print_line_numbers ());
......@@ -548,8 +549,11 @@ gedit_print_job_info_new (GeditDocument* doc)
left = g_strdup_printf (_("File: %s"), name_to_display);
/* Translators: %N is the current page number, %Q is the total
* number of pages (ex. Page 2 of 10)
*/
gtk_source_print_job_set_header_format (pjob,
left, NULL, "Page %N/%Q", TRUE);
left, NULL, _("Page %N of %Q"), TRUE);
gtk_source_print_job_set_print_header (pjob, TRUE);
......
......@@ -32,9 +32,8 @@
_tip="Print the current file" pixtype="stock" pixname="gtk-print"
accel="*Control*P"/>
<cmd name="FilePrintSetup" _label="Print Setup"
_tip="Setup the page settings for your current printer"
pixtype="stock" pixname="gtk-print"/>
<cmd name="FilePageSetup" _label="Page Set_up"
_tip="Setup the page settings"/>
<cmd name="FilePrintPreview" _label="Print Preview"
_tip="Print preview" pixtype="stock" pixname="gtk-print-preview"
......@@ -146,7 +145,9 @@
<menuitem name="FileRevert" verb="" _label="_Revert"/>
<separator/>
<menuitem name="FilePageSetup" verb=""/>
<menuitem name="FilePrintPreview" verb="" _label="Print Previe_w..."/>
<menuitem name="FilePrint" verb="" _label="_Print..."/>
......
......@@ -1284,6 +1284,25 @@ gedit_utils_get_stdin (void)
return g_string_free (file_contents, FALSE);
}
void
gedit_warning (gchar *str, GtkWindow *parent)
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (
parent,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
str);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
......@@ -84,6 +84,8 @@ gboolean gedit_utils_create_empty_file (const gchar *uri);
gchar *gedit_utils_get_stdin (void);
void gedit_warning (gchar *str, GtkWindow *parent);
#endif /* __GEDIT_UTILS_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment