Verified Commit ddc1c707 authored by Zander's avatar Zander 💥

We always have a config.h

parent 8d7fc4f4
......@@ -19,16 +19,14 @@
/* Autosave */
/* Automatically save a copy with the .autosave extension after idle time.
* Don't autosave unmodified diagrams, and remove the autosave file when
* Don't autosave unmodified diagrams, and remove the autosave file when
* the diagram is saved successfully. Also remove autosave file when the
* diagram is closed, even if it was modified.
* If (auto)saving crashes you, this will really fuck you over!
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "autosave.h"
#include "diagram.h"
......@@ -57,7 +55,7 @@ autosave_check_autosave(gpointer data)
while (diagrams != NULL) {
diagram = (Diagram *)diagrams->data;
if (diagram_is_modified(diagram) &&
if (diagram_is_modified(diagram) &&
!diagram->autosaved) {
/* Diagram has been modified. At next idleness, save it */
g_idle_add ((GSourceFunc)autosave_save_diagram, diagram);
......
......@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
......
......@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "dia-line-width-area.h"
#include "attributes.h"
......
/* Dia -- an diagram creation/manipulation program
* Copyright © 2019 Zander Brown <zbrown@gnome.org>
*
* 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.
*/
#include <config.h>
#include "dia-palette.h"
struct _DiaPalette
{
GtkGrid parent;
int active;
GtkWidget *dialog;
GtkWidget *button;
};
G_DEFINE_TYPE (DiaPalette, dia_palette, GTK_TYPE_GRID)
static void
dia_palette_dialog_ok (GtkWidget *widget, DiaPalette *self)
{
gtk_dialog_response (GTK_DIALOG (self->dialog), GTK_RESPONSE_OK);
}
static void
dia_palette_class_init (DiaPaletteClass *class)
{
}
static void
dia_palette_init (DiaPalette *self)
{
}
GtkWidget *
dia_palette_new ()
{
return g_object_new (DIA_TYPE_PALETTE, NULL);
}
......@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <config.h>
#include "dia-props.h"
......@@ -53,7 +51,7 @@ diagram_properties_update_sensitivity(GtkToggleButton *widget,
if (!dia)
return; /* safety first */
dia->grid.dynamic =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dynamic_check));
dyn_grid = dia->grid.dynamic;
......@@ -120,9 +118,9 @@ create_diagram_properties_dialog(Diagram *dia)
dynamic_check = gtk_check_button_new_with_label(_("Dynamic grid"));
gtk_table_attach(GTK_TABLE(table), dynamic_check, 1,2, 0,1,
GTK_FILL, GTK_FILL, 0, 0);
g_signal_connect(G_OBJECT(dynamic_check), "toggled",
g_signal_connect(G_OBJECT(dynamic_check), "toggled",
G_CALLBACK(diagram_properties_update_sensitivity), NULL);
gtk_widget_show(dynamic_check);
label = gtk_label_new(_("x"));
......@@ -178,9 +176,9 @@ create_diagram_properties_dialog(Diagram *dia)
hex_check = gtk_check_button_new_with_label(_("Hex grid"));
gtk_table_attach(GTK_TABLE(table), hex_check, 1,2, 4,5,
GTK_FILL, GTK_FILL, 0, 0);
g_signal_connect(G_OBJECT(hex_check), "toggled",
g_signal_connect(G_OBJECT(hex_check), "toggled",
G_CALLBACK(diagram_properties_update_sensitivity), NULL);
gtk_widget_show(hex_check);
label = gtk_label_new(_("Hex grid size"));
......@@ -284,7 +282,7 @@ diagram_properties_retrieve(Diagram *dia)
&dia->data->bg_color);
dia_color_selector_set_color(grid_colour,
&dia->grid.colour);
dia_color_selector_set_color(pagebreak_colour,
dia_color_selector_set_color(pagebreak_colour,
&dia->pagebreak_color);
diagram_properties_update_sensitivity(GTK_TOGGLE_BUTTON(dynamic_check), dia);
......@@ -299,11 +297,11 @@ diagram_properties_show(Diagram *dia)
gtk_widget_destroy(dialog);
dialog = NULL;
}
create_diagram_properties_dialog(dia);
diagram_properties_retrieve(dia);
gtk_window_set_transient_for(GTK_WINDOW(dialog),
GTK_WINDOW (ddisplay_active()->shell));
gtk_widget_show(dialog);
......@@ -319,13 +317,13 @@ diagram_properties_respond(GtkWidget *widget,
if (response_id == GTK_RESPONSE_OK ||
response_id == GTK_RESPONSE_APPLY) {
if (active_diagram) {
/* we do not bother for the actual change, just record the
/* we do not bother for the actual change, just record the
* whole possible change */
undo_change_memswap (active_diagram,
undo_change_memswap (active_diagram,
&active_diagram->grid, sizeof(active_diagram->grid));
undo_change_memswap (active_diagram,
undo_change_memswap (active_diagram,
&active_diagram->data->bg_color, sizeof(active_diagram->data->bg_color));
undo_change_memswap (active_diagram,
undo_change_memswap (active_diagram,
&active_diagram->pagebreak_color, sizeof(active_diagram->pagebreak_color));
undo_set_transactionpoint(active_diagram->undo);
......
......@@ -21,9 +21,7 @@
/*#define PAGELAYOUT_TEST*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "diapagelayout.h"
#include "widgets.h"
......
......@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <string.h>
......
......@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <stdio.h>
......
......@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
......@@ -82,7 +80,7 @@ grid_step (DDisplay *ddisp, GtkOrientation orientation,
}
static void
grid_draw_horizontal_lines(DDisplay *ddisp, Rectangle *update, real length)
grid_draw_horizontal_lines(DDisplay *ddisp, Rectangle *update, real length)
{
int x, y;
real pos;
......@@ -131,7 +129,7 @@ grid_draw_horizontal_lines(DDisplay *ddisp, Rectangle *update, real length)
}
static void
grid_draw_vertical_lines(DDisplay *ddisp, Rectangle *update, real length)
grid_draw_vertical_lines(DDisplay *ddisp, Rectangle *update, real length)
{
int x = 0, y = 0;
real pos;
......@@ -185,13 +183,13 @@ grid_draw_hex(DDisplay *ddisp, Rectangle *update, real length)
while (horiz_pos <= update->right) {
ddisplay_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
ddisplay_transform_coords(ddisp, horiz_pos + length, vert_pos, &to_x, &y);
irenderer->draw_pixel_line(renderer,
x, y, to_x, y,
&ddisp->diagram->grid.colour);
horiz_pos += 3 * length;
}
vert_pos += sqrt(3) * length;
}
......@@ -202,13 +200,13 @@ grid_draw_hex(DDisplay *ddisp, Rectangle *update, real length)
while (horiz_pos <= update->right) {
ddisplay_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
ddisplay_transform_coords(ddisp, horiz_pos+length, vert_pos, &to_x, &y);
irenderer->draw_pixel_line(renderer,
x, y, to_x, y,
&ddisp->diagram->grid.colour);
horiz_pos += 3 * length;
}
vert_pos += sqrt(3) * length;
}
......@@ -219,20 +217,20 @@ grid_draw_hex(DDisplay *ddisp, Rectangle *update, real length)
while (horiz_pos <= update->right) {
ddisplay_transform_coords(ddisp, horiz_pos + length, vert_pos, &x, &y);
ddisplay_transform_coords(ddisp, horiz_pos + 1.5 * length, vert_pos + length * sqrt(3) * 0.5, &to_x, &to_y);
irenderer->draw_pixel_line(renderer,
x, y, to_x, to_y,
&ddisp->diagram->grid.colour);
ddisplay_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
ddisplay_transform_coords(ddisp, horiz_pos - 0.5 * length, vert_pos + length * sqrt(3) * 0.5, &to_x, &to_y);
irenderer->draw_pixel_line(renderer,
x, y, to_x, to_y,
&ddisp->diagram->grid.colour);
horiz_pos += 3 * length;
}
vert_pos += sqrt(3) * length;
}
......@@ -243,14 +241,14 @@ grid_draw_hex(DDisplay *ddisp, Rectangle *update, real length)
while (horiz_pos <= update->right) {
ddisplay_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
ddisplay_transform_coords(ddisp, horiz_pos - 0.5 * length, vert_pos + 0.5 * sqrt(3) * length, &to_x, &to_y);
irenderer->draw_pixel_line(renderer,
x, y, to_x, to_y,
&ddisp->diagram->grid.colour);
ddisplay_transform_coords(ddisp, horiz_pos + length, vert_pos, &x, &y);
ddisplay_transform_coords(ddisp, horiz_pos + 1.5 * length, vert_pos + 0.5 * sqrt(3) * length, &to_x, &to_y);
irenderer->draw_pixel_line(renderer,
x, y, to_x, to_y,
&ddisp->diagram->grid.colour);
......@@ -283,7 +281,7 @@ grid_draw(DDisplay *ddisp, Rectangle *update)
}
DIA_RENDERER_GET_CLASS(renderer)->set_linewidth(renderer, 0.0);
if (ddisp->diagram->grid.hex) {
grid_draw_hex(ddisp, update, width_w);
} else {
......@@ -306,7 +304,7 @@ pagebreak_draw(DDisplay *ddisp, Rectangle *update)
int width = dia_renderer_get_width_pixels(ddisp->renderer);
int height = dia_renderer_get_height_pixels(ddisp->renderer);
irenderer = DIA_GET_INTERACTIVE_RENDERER_INTERFACE (renderer);
if (prefs.pagebreak.visible) {
Diagram *dia = ddisp->diagram;
......
......@@ -22,9 +22,7 @@
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <assert.h>
#include <string.h>
......
......@@ -17,9 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
......
......@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
......@@ -58,12 +56,12 @@ void
object_add_updates_list(GList *list, Diagram *dia)
{
DiaObject *obj;
while (list != NULL) {
obj = (DiaObject *)list->data;
object_add_updates(obj, dia);
list = g_list_next(list);
}
}
......@@ -78,7 +76,7 @@ object_add_updates_list(GList *list, Diagram *dia)
* in this call (anded to the display-wide setting).
*/
ConnectionPoint *
object_find_connectpoint_display(DDisplay *ddisp, Point *pos,
object_find_connectpoint_display(DDisplay *ddisp, Point *pos,
DiaObject *notthis, gboolean snap_to_objects)
{
real distance;
......@@ -87,7 +85,7 @@ object_find_connectpoint_display(DDisplay *ddisp, Point *pos,
DiaObject *obj_here;
distance =
diagram_find_closest_connectionpoint(ddisp->diagram, &connectionpoint,
diagram_find_closest_connectionpoint(ddisp->diagram, &connectionpoint,
pos, notthis);
distance = ddisplay_transform_length(ddisp, distance);
......@@ -130,7 +128,7 @@ object_connect_display(DDisplay *ddisp, DiaObject *obj, Handle *handle,
if (handle->connected_to == NULL) {
connectionpoint = object_find_connectpoint_display(ddisp, &handle->pos,
obj, snap_to_objects);
if (connectionpoint != NULL) {
Change *change = undo_connect(ddisp->diagram, obj, handle,
connectionpoint);
......@@ -153,7 +151,7 @@ object_list_corner(GList *list)
p.y = obj->bounding_box.top;
list = g_list_next(list);
while (list != NULL) {
obj = (DiaObject *)list->data;
......@@ -161,7 +159,7 @@ object_list_corner(GList *list)
p.x = obj->bounding_box.left;
if (p.y > obj->bounding_box.top)
p.y = obj->bounding_box.top;
list = g_list_next(list);
}
......@@ -199,7 +197,7 @@ filter_connected (const GList *objects,
GList **unconnected)
{
const GList *list;
for (list = objects; list != NULL; list = g_list_next (list)) {
DiaObject *obj = list->data;
gboolean is_connected = 0;
......@@ -319,7 +317,7 @@ object_list_align_v(GList *objects, Diagram *dia, int align)
default:
message_warning("Wrong argument to object_list_align_v()\n");
}
dest_pos = g_new(Point, nobjs);
orig_pos = g_new(Point, nobjs);
......@@ -329,7 +327,7 @@ object_list_align_v(GList *objects, Diagram *dia, int align)
obj = (DiaObject *) list->data;
pos.x = obj->position.x;
switch (align) {
case DIA_ALIGN_TOP: /* TOP */
pos.y = y_pos + obj->position.y - obj->bounding_box.top;
......@@ -357,20 +355,20 @@ object_list_align_v(GList *objects, Diagram *dia, int align)
orig_pos[i] = obj->position;
dest_pos[i] = pos;
obj->ops->move(obj, &pos);
i++;
list = g_list_next(list);
}
undo_move_objects(dia, orig_pos, dest_pos, g_list_copy(objects));
g_list_free (unconnected);
}
static int
object_list_sort_horizontal(const void *o1, const void *o2)
object_list_sort_horizontal(const void *o1, const void *o2)
{
DiaObject *obj1 = *(DiaObject **)o1;
DiaObject *obj2 = *(DiaObject **)o2;
......@@ -509,9 +507,9 @@ object_list_align_h(GList *objects, Diagram *dia, int align)
x_pos += obj->bounding_box.right - obj->bounding_box.left;
break;
}
pos.y = obj->position.y;
orig_pos[i] = obj->position;
dest_pos[i] = pos;
......@@ -520,8 +518,8 @@ object_list_align_h(GList *objects, Diagram *dia, int align)
i++;
list = g_list_next(list);
}
undo_move_objects(dia, orig_pos, dest_pos, g_list_copy(objects));
undo_move_objects(dia, orig_pos, dest_pos, g_list_copy(objects));
g_list_free (unconnected);
}
......@@ -565,7 +563,7 @@ object_list_align_connected (GList *objects, Diagram *dia, int align)
/* for every connection check:
* - "matching" directions of both object connection points (this also gives
* the direction of the move of the second object)
* -
* -
* - move every object only once
*/
nobjs = g_list_length (to_be_moved);
......@@ -655,7 +653,7 @@ object_list_align_connected (GList *objects, Diagram *dia, int align)
}
}
}
list = g_list_next (list);
}
......@@ -701,7 +699,7 @@ object_list_nudge(GList *objects, Diagram *dia, Direction dir, real step)
list = objects;
while (list != NULL) {
obj = (DiaObject *) list->data;
orig_pos[i] = obj->position;
dest_pos[i].x = orig_pos[i].x + inc_x;
dest_pos[i].y = orig_pos[i].y + inc_y;
......
......@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gtk/gtk.h>
......@@ -44,13 +42,13 @@ static void pagesetup_changed (GtkWidget *wid, PageSetup *ps);
static void pagesetup_apply (GtkWidget *wid, PageSetup *ps);
static gint
pagesetup_respond(GtkWidget *widget,
pagesetup_respond(GtkWidget *widget,
gint response_id,
gpointer data)
{
PageSetup *ps = (PageSetup *)data;
if ( response_id == GTK_RESPONSE_APPLY
if ( response_id == GTK_RESPONSE_APPLY
|| response_id == GTK_RESPONSE_OK) {
if (ps->changed)
pagesetup_apply(widget, ps);
......@@ -181,7 +179,7 @@ pagesetup_apply(GtkWidget *wid, PageSetup *ps)
&ps->dia->data->paper.bmargin,
&ps->dia->data->paper.lmargin,
&ps->dia->data->paper.rmargin);
ps->dia->data->paper.is_portrait =
dia_page_layout_get_orientation(DIA_PAGE_LAYOUT(ps->paper)) ==
DIA_PAGE_ORIENT_PORTRAIT;
......@@ -202,7 +200,7 @@ pagesetup_apply(GtkWidget *wid, PageSetup *ps)
gtk_dialog_set_response_sensitive(GTK_DIALOG(ps->window), GTK_RESPONSE_APPLY, FALSE);
ps->changed = FALSE;
/* update diagram -- this is needed to reposition page boundaries */
diagram_set_modified(ps->dia, TRUE);
diagram_add_update_all(ps->dia);
......
......@@ -5,7 +5,7 @@
* Copyright (C) 2000 James Henstridge
* almost complete rewrite for gtk2
* Copyright (C) 2002 Hans Breuer
*
*
* 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
......@@ -21,9 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <config.h>
#include <string.h>
......@@ -72,9 +70,9 @@ toggle_loaded_callback (GtkCellRendererToggle *celltoggle,
}
gtk_tree_path_free (path);
gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
LOADED_COLUMN, &loaded, -1);
gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
PLUGIN_COLUMN, &info, -1);
if (loaded && dia_plugin_can_unload(info))
......@@ -89,7 +87,7 @@ toggle_loaded_callback (GtkCellRendererToggle *celltoggle,
}
else
message_notice("Can't unload plugin '%s'!", dia_plugin_get_name(info));
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
LOADED_COLUMN, loaded, -1);
}
......@@ -103,13 +101,13 @@ can_unload (GtkTreeViewColumn *tree_column,
PluginInfo *info;
gboolean loaded;
gtk_tree_model_get(tree_model, iter,
gtk_tree_model_get(tree_model, iter,
PLUGIN_COLUMN, &info, -1);
gtk_tree_model_get(tree_model, iter,
gtk_tree_model_get(tree_model, iter,
LOADED_COLUMN, &loaded, -1);
if (!loaded || (loaded && dia_plugin_can_unload(info)))
{
g_object_set (cell,
g_object_set (cell,
"mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
"activatable", TRUE,
NULL);
......@@ -142,9 +140,9 @@ toggle_autoload_callback (GtkCellRendererToggle *celltoggle,
}
gtk_tree_path_free (path);
gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
AUTOLOAD_COLUMN, &load, -1);
gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
PLUGIN_COLUMN, &info, -1);
/* Disabling 'Standard' is fatal at next startup, while
......@@ -156,7 +154,7 @@ toggle_autoload_callback (GtkCellRendererToggle *celltoggle,
"of plugin '%s'!", dia_plugin_get_name(info));
else {
dia_plugin_set_inhibit_load(info, load);
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
AUTOLOAD_COLUMN, !load, -1);
}
}
......@@ -170,7 +168,7 @@ can_inhibit (GtkTreeViewColumn *tree_column,
{
PluginInfo *info;
gtk_tree_model_get(tree_model, iter,
gtk_tree_model_get(tree_model, iter,
PLUGIN_COLUMN, &info, -1);
if ( 0 == strcmp(dia_plugin_get_name(info), "Standard")
|| 0 == strcmp(dia_plugin_get_name(info), "Internal"))
......@@ -182,7 +180,7 @@ can_inhibit (GtkTreeViewColumn *tree_column,
}
else
{
g_object_set (cell,
g_object_set (cell,
"mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
"activatable", TRUE,
NULL);
......@@ -231,8 +229,8 @@ get_plugin_manager(void)
/* create the TreeStore */
store = gtk_list_store_new (NUM_COLUMNS,
G_TYPE_BOOLEAN,
G_TYPE_STRING,
G_TYPE_BOOLEAN,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_BOOLEAN,
......
......@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
......
......@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gdk/gdkkeysyms.h>
......@@ -52,7 +50,7 @@ recent_file_history_clear_menu()
menus_clear_recent ();
}
/**
/**
* Build and insert the recent files menu.
*/
static void
......@@ -70,8 +68,8 @@ recent_file_history_make_menu()
group = gtk_action_group_new ("recent-files");
gtk_action_group_set_translation_domain (group, NULL);
for (i = 0;
items != NULL && i < prefs.recent_documents_list_size;