Migrated the margin and padding constants and functions in menu.c, alloc.c, and util.c.
This commit is contained in:
parent
1c83d674a5
commit
afaec644cc
|
@ -1,19 +1,5 @@
|
|||
#define gtkXMargin 12
|
||||
#define gtkYMargin 12
|
||||
#define gtkXPadding 12
|
||||
#define gtkYPadding 6
|
||||
|
||||
// menu.c
|
||||
extern GtkWidget *makeMenubar(uiWindow *);
|
||||
extern void freeMenubar(GtkWidget *);
|
||||
extern void uninitMenus(void);
|
||||
|
||||
// alloc.c
|
||||
extern void initAlloc(void);
|
||||
extern void uninitAlloc(void);
|
||||
|
||||
// util.c
|
||||
extern void setMargined(GtkContainer *, int);
|
||||
|
||||
// child.c
|
||||
extern struct child *newChild(uiControl *child, uiControl *parent, GtkContainer *parentContainer);
|
||||
|
|
|
@ -13,7 +13,7 @@ static GPtrArray *allocations;
|
|||
#define CCHAR(p) ((const char **) (p))
|
||||
#define TYPE(p) CCHAR(UINT8(p) + sizeof (size_t))
|
||||
|
||||
void initAlloc(void)
|
||||
void uiprivInitAlloc(void)
|
||||
{
|
||||
allocations = g_ptr_array_new();
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ static void uninitComplain(gpointer ptr, gpointer data)
|
|||
*str = str2;
|
||||
}
|
||||
|
||||
void uninitAlloc(void)
|
||||
void uiprivUninitAlloc(void)
|
||||
{
|
||||
char *str = NULL;
|
||||
|
||||
|
|
|
@ -119,9 +119,9 @@ void uiBoxSetPadded(uiBox *b, int padded)
|
|||
b->padded = padded;
|
||||
if (b->padded)
|
||||
if (b->vertical)
|
||||
gtk_box_set_spacing(b->box, gtkYPadding);
|
||||
gtk_box_set_spacing(b->box, uiprivGTKYPadding);
|
||||
else
|
||||
gtk_box_set_spacing(b->box, gtkXPadding);
|
||||
gtk_box_set_spacing(b->box, uiprivGTKXPadding);
|
||||
else
|
||||
gtk_box_set_spacing(b->box, 0);
|
||||
}
|
||||
|
|
|
@ -116,5 +116,5 @@ GtkWidget *childBox(struct child *c)
|
|||
|
||||
void childSetMargined(struct child *c, int margined)
|
||||
{
|
||||
setMargined(GTK_CONTAINER(c->box), margined);
|
||||
uiprivSetMargined(GTK_CONTAINER(c->box), margined);
|
||||
}
|
||||
|
|
|
@ -133,8 +133,8 @@ void uiFormSetPadded(uiForm *f, int padded)
|
|||
{
|
||||
f->padded = padded;
|
||||
if (f->padded) {
|
||||
gtk_grid_set_row_spacing(f->grid, gtkYPadding);
|
||||
gtk_grid_set_column_spacing(f->grid, gtkXPadding);
|
||||
gtk_grid_set_row_spacing(f->grid, uiprivGTKYPadding);
|
||||
gtk_grid_set_column_spacing(f->grid, uiprivGTKXPadding);
|
||||
} else {
|
||||
gtk_grid_set_row_spacing(f->grid, 0);
|
||||
gtk_grid_set_column_spacing(f->grid, 0);
|
||||
|
|
|
@ -117,8 +117,8 @@ void uiGridSetPadded(uiGrid *g, int padded)
|
|||
{
|
||||
g->padded = padded;
|
||||
if (g->padded) {
|
||||
gtk_grid_set_row_spacing(g->grid, gtkYPadding);
|
||||
gtk_grid_set_column_spacing(g->grid, gtkXPadding);
|
||||
gtk_grid_set_row_spacing(g->grid, uiprivGTKYPadding);
|
||||
gtk_grid_set_column_spacing(g->grid, uiprivGTKXPadding);
|
||||
} else {
|
||||
gtk_grid_set_row_spacing(g->grid, 0);
|
||||
gtk_grid_set_column_spacing(g->grid, 0);
|
||||
|
|
|
@ -14,15 +14,15 @@ const char *uiInit(uiInitOptions *o)
|
|||
g_error_free(err);
|
||||
return msg;
|
||||
}
|
||||
initAlloc();
|
||||
uiprivInitAlloc();
|
||||
loadFutures();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void uiUninit(void)
|
||||
{
|
||||
uninitMenus();
|
||||
uninitAlloc();
|
||||
uiprivUninitMenus();
|
||||
uiprivUninitAlloc();
|
||||
}
|
||||
|
||||
void uiFreeInitError(const char *err)
|
||||
|
|
|
@ -266,7 +266,7 @@ static void appendMenuItem(GtkMenuShell *submenu, uiMenuItem *item, uiWindow *w)
|
|||
g_hash_table_insert(item->windows, menuitem, ww);
|
||||
}
|
||||
|
||||
GtkWidget *makeMenubar(uiWindow *w)
|
||||
GtkWidget *uiprivMakeMenubar(uiWindow *w)
|
||||
{
|
||||
GtkWidget *menubar;
|
||||
guint i, j;
|
||||
|
@ -330,7 +330,7 @@ static void freeMenu(GtkWidget *widget, gpointer data)
|
|||
(*i)++;
|
||||
}
|
||||
|
||||
void freeMenubar(GtkWidget *mb)
|
||||
void uiprivFreeMenubar(GtkWidget *mb)
|
||||
{
|
||||
guint i;
|
||||
|
||||
|
@ -339,7 +339,7 @@ void freeMenubar(GtkWidget *mb)
|
|||
// no need to worry about destroying any widgets; destruction of the window they're in will do it for us
|
||||
}
|
||||
|
||||
void uninitMenus(void)
|
||||
void uiprivUninitMenus(void)
|
||||
{
|
||||
uiMenu *m;
|
||||
uiMenuItem *item;
|
||||
|
|
|
@ -14,4 +14,21 @@
|
|||
#include "../ui_unix.h"
|
||||
#include "../common/uipriv.h"
|
||||
|
||||
#define uiprivGTKXMargin 12
|
||||
#define uiprivGTKYMargin 12
|
||||
#define uiprivGTKXPadding 12
|
||||
#define uiprivGTKYPadding 6
|
||||
|
||||
// menu.c
|
||||
extern GtkWidget *uiprivMakeMenubar(uiWindow *);
|
||||
extern void uiprivFreeMenubar(GtkWidget *);
|
||||
extern void uiprivUninitMenus(void);
|
||||
|
||||
// alloc.c
|
||||
extern void uiprivInitAlloc(void);
|
||||
extern void uiprivUninitAlloc(void);
|
||||
|
||||
// util.c
|
||||
extern void uiprivSetMargined(GtkContainer *, int);
|
||||
|
||||
#include "OLD_uipriv_unix.h"
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// 18 april 2015
|
||||
#include "uipriv_unix.h"
|
||||
|
||||
void setMargined(GtkContainer *c, int margined)
|
||||
void uiprivSetMargined(GtkContainer *c, int margined)
|
||||
{
|
||||
if (margined)
|
||||
gtk_container_set_border_width(c, gtkXMargin);
|
||||
gtk_container_set_border_width(c, uiprivGTKXMargin);
|
||||
else
|
||||
gtk_container_set_border_width(c, 0);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ static void uiWindowDestroy(uiControl *c)
|
|||
}
|
||||
// now destroy the menus, if any
|
||||
if (w->menubar != NULL)
|
||||
freeMenubar(w->menubar);
|
||||
uiprivFreeMenubar(w->menubar);
|
||||
gtk_widget_destroy(w->childHolderWidget);
|
||||
gtk_widget_destroy(w->vboxWidget);
|
||||
// and finally free ourselves
|
||||
|
@ -226,7 +226,7 @@ int uiWindowMargined(uiWindow *w)
|
|||
void uiWindowSetMargined(uiWindow *w, int margined)
|
||||
{
|
||||
w->margined = margined;
|
||||
setMargined(w->childHolderContainer, w->margined);
|
||||
uiprivSetMargined(w->childHolderContainer, w->margined);
|
||||
}
|
||||
|
||||
uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
||||
|
@ -250,7 +250,7 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
|
|||
gtk_container_add(w->container, w->vboxWidget);
|
||||
|
||||
if (hasMenubar) {
|
||||
w->menubar = makeMenubar(uiWindow(w));
|
||||
w->menubar = uiprivMakeMenubar(uiWindow(w));
|
||||
gtk_container_add(w->vboxContainer, w->menubar);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue