Working YellowNotes on Windows.

This commit is contained in:
2025-11-20 16:59:14 +01:00
parent 36aba3a381
commit ea3f447af1
16 changed files with 1607 additions and 123 deletions

View File

@@ -9,7 +9,8 @@ add_executable(yellownotes main.cpp
gtk-imports.h
gtkloader.h gtkloader.cpp
gtk-imports.c
yellownotes.h yellownotes.cpp)
yellownotes.h yellownotes.cpp
tr.h tr.cpp)
include(GNUInstallDirs)
install(TARGETS yellownotes

BIN
color.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

17
color.svg Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" standalone="no"?>
<svg width="128" height="128" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Font-Color</title>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Font-Color">
<rect id="Rectangle" fill-rule="nonzero" x="0" y="0" width="24" height="24">
</rect>
<path d="M18,13.1842 C18,16.6723 15.3137,19.5 12,19.5 C8.68629,19.5 6,16.6723 6,13.1842 C6,8.5 12,5 12,5 C12,5 18,8.5 18,13.1842 Z" id="Path" stroke="#0C0310" stroke-width="2" stroke-linecap="round">
</path>
<path d="M12,15.5 C10.8954,15.5 10,14.6046 10,13.5" id="Path" stroke="#0C0310" stroke-width="2" stroke-linecap="round">
</path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 810 B

BIN
delete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

10
delete.svg Normal file
View File

@@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="256" height="256" viewBox="0 0 256 256" xml:space="preserve">
<g style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: none; fill-rule: nonzero; opacity: 1;" transform="translate(1.4065934065934016 1.4065934065934016) scale(2.81 2.81)">
<path d="M 67.692 90 H 22.308 c -3.042 0 -5.518 -2.476 -5.518 -5.518 v -61 c 0 -1.104 0.896 -2 2 -2 h 52.42 c 1.104 0 2 0.896 2 2 v 61 C 73.21 87.524 70.734 90 67.692 90 z M 20.79 25.482 v 59 c 0 0.837 0.681 1.518 1.518 1.518 h 45.385 c 0.837 0 1.518 -0.681 1.518 -1.518 v -59 H 20.79 z" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round"/>
<path d="M 73.196 25.482 H 16.804 c -3.042 0 -5.518 -2.475 -5.518 -5.518 v -4.335 c 0 -3.042 2.475 -5.518 5.518 -5.518 h 56.393 c 3.042 0 5.518 2.475 5.518 5.518 v 4.335 C 78.714 23.007 76.238 25.482 73.196 25.482 z M 16.804 14.112 c -0.837 0 -1.518 0.681 -1.518 1.518 v 4.335 c 0 0.837 0.681 1.518 1.518 1.518 h 56.393 c 0.837 0 1.518 -0.681 1.518 -1.518 v -4.335 c 0 -0.837 -0.681 -1.518 -1.518 -1.518 H 16.804 z" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round"/>
<path d="M 57.197 14.112 H 32.803 c -1.104 0 -2 -0.896 -2 -2 V 5.518 C 30.803 2.476 33.278 0 36.321 0 h 17.358 c 3.043 0 5.519 2.476 5.519 5.518 v 6.594 C 59.197 13.216 58.302 14.112 57.197 14.112 z M 34.803 10.112 h 20.395 V 5.518 C 55.197 4.681 54.516 4 53.679 4 H 36.321 c -0.837 0 -1.518 0.681 -1.518 1.518 V 10.112 z" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round"/>
<path d="M 45 78.624 c -1.104 0 -2 -0.896 -2 -2 V 34.856 c 0 -1.104 0.896 -2 2 -2 s 2 0.896 2 2 v 41.768 C 47 77.729 46.104 78.624 45 78.624 z" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round"/>
<path d="M 58.222 78.624 c -1.104 0 -2 -0.896 -2 -2 V 34.856 c 0 -1.104 0.896 -2 2 -2 s 2 0.896 2 2 v 41.768 C 60.222 77.729 59.326 78.624 58.222 78.624 z" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round"/>
<path d="M 31.779 78.624 c -1.104 0 -2 -0.896 -2 -2 V 34.856 c 0 -1.104 0.896 -2 2 -2 s 2 0.896 2 2 v 41.768 C 33.779 77.729 32.883 78.624 31.779 78.624 z" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" transform=" matrix(1 0 0 1 0 0) " stroke-linecap="round"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -44,12 +44,30 @@ typedef GtkMenuShell GtkMenu;
typedef void GtkMenuItem;
typedef void GdkEvent;
typedef void GtkTextBuffer;
typedef void GtkTextView;
typedef void GtkTextTagTable;
typedef void GtkContainer;
typedef void GtkLabel;
typedef void GtkHeaderBar;
typedef void GdkWindow;
typedef void GdkDevice;
typedef void GtkImage;
typedef void GdkPixbuf;
typedef void GError;
typedef void GtkStyleContext;
typedef void GtkCssProvider;
typedef void GtkStyleProvider;
typedef void GtkWidgetPath;
typedef void GtkAdjustment;
typedef void GtkFrame;
typedef void GtkEventBox;
typedef void GdkCursor;
typedef void GdkDisplay;
typedef void GtkEntry;
typedef void GtkDialog;
typedef void GTimer;
typedef void GtkComboBoxText;
typedef void GtkComboBox;
typedef int gboolean;
typedef int gint;
@@ -63,11 +81,14 @@ typedef unsigned long long guint64;
typedef float gfloat;
typedef double gdouble;
typedef char gint8;
typedef unsigned char guint8;
typedef short gint16;
typedef unsigned short guint16;
typedef size_t gssize;
typedef enum {
GTK_WINDOW_TOPLEVEL = 0
GTK_WINDOW_TOPLEVEL = 0,
GTK_WINDOW_POPUP = 1
} GtkWindowType;
typedef enum {
@@ -172,36 +193,56 @@ typedef struct _GtkTextIter {
typedef enum
{
GDK_DELETE,
GDK_MOTION_NOTIFY,
GDK_BUTTON_PRESS,
GDK_BUTTON_RELEASE,
GDK_KEY_PRESS,
GDK_KEY_RELEASE,
GDK_ENTER_NOTIFY,
GDK_LEAVE_NOTIFY,
GDK_FOCUS_CHANGE,
GDK_PROXIMITY_IN,
GDK_PROXIMITY_OUT,
GDK_DRAG_ENTER,
GDK_DRAG_LEAVE,
GDK_DRAG_MOTION,
GDK_DROP_START,
GDK_SCROLL,
GDK_GRAB_BROKEN,
GDK_TOUCH_BEGIN,
GDK_TOUCH_UPDATE,
GDK_TOUCH_END,
GDK_TOUCH_CANCEL,
GDK_TOUCHPAD_SWIPE,
GDK_TOUCHPAD_PINCH,
GDK_PAD_BUTTON_PRESS,
GDK_PAD_BUTTON_RELEASE,
GDK_PAD_RING,
GDK_PAD_STRIP,
GDK_PAD_GROUP_MODE,
GDK_TOUCHPAD_HOLD,
GDK_PAD_DIAL,
GDK_NOTHING = -1,
GDK_DELETE = 0,
GDK_DESTROY = 1,
GDK_EXPOSE = 2,
GDK_MOTION_NOTIFY = 3,
GDK_BUTTON_PRESS = 4,
GDK_2BUTTON_PRESS = 5,
GDK_DOUBLE_BUTTON_PRESS = GDK_2BUTTON_PRESS,
GDK_3BUTTON_PRESS = 6,
GDK_TRIPLE_BUTTON_PRESS = GDK_3BUTTON_PRESS,
GDK_BUTTON_RELEASE = 7,
GDK_KEY_PRESS = 8,
GDK_KEY_RELEASE = 9,
GDK_ENTER_NOTIFY = 10,
GDK_LEAVE_NOTIFY = 11,
GDK_FOCUS_CHANGE = 12,
GDK_CONFIGURE = 13,
GDK_MAP = 14,
GDK_UNMAP = 15,
GDK_PROPERTY_NOTIFY = 16,
GDK_SELECTION_CLEAR = 17,
GDK_SELECTION_REQUEST = 18,
GDK_SELECTION_NOTIFY = 19,
GDK_PROXIMITY_IN = 20,
GDK_PROXIMITY_OUT = 21,
GDK_DRAG_ENTER = 22,
GDK_DRAG_LEAVE = 23,
GDK_DRAG_MOTION = 24,
GDK_DRAG_STATUS = 25,
GDK_DROP_START = 26,
GDK_DROP_FINISHED = 27,
GDK_CLIENT_EVENT = 28,
GDK_VISIBILITY_NOTIFY = 29,
GDK_SCROLL = 31,
GDK_WINDOW_STATE = 32,
GDK_SETTING = 33,
GDK_OWNER_CHANGE = 34,
GDK_GRAB_BROKEN = 35,
GDK_DAMAGE = 36,
GDK_TOUCH_BEGIN = 37,
GDK_TOUCH_UPDATE = 38,
GDK_TOUCH_END = 39,
GDK_TOUCH_CANCEL = 40,
GDK_TOUCHPAD_SWIPE = 41,
GDK_TOUCHPAD_PINCH = 42,
GDK_PAD_BUTTON_PRESS = 43,
GDK_PAD_BUTTON_RELEASE = 44,
GDK_PAD_RING = 45,
GDK_PAD_STRIP = 46,
GDK_PAD_GROUP_MODE = 47,
GDK_EVENT_LAST /* helper variable for decls */
} GdkEventType;
@@ -235,8 +276,22 @@ typedef struct _GdkEventMotion
gdouble x_root, y_root;
} GdkEventMotion;
typedef struct _GdkEventKey
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
guint32 time;
guint state;
guint keyval;
gint length;
gchar *string;
guint16 hardware_keycode;
guint8 group;
guint is_modifier : 1;
} GdkEventKey;
#define GDK_KEY_Escape 65307
typedef enum
{
@@ -268,14 +323,260 @@ typedef enum
GDK_ALL_EVENTS_MASK = 0x3FFFFFE
} GdkEventMask;
typedef enum
{
GTK_STATE_FLAG_NORMAL = 0,
GTK_STATE_FLAG_ACTIVE = 1 << 0,
GTK_STATE_FLAG_PRELIGHT = 1 << 1,
GTK_STATE_FLAG_SELECTED = 1 << 2,
GTK_STATE_FLAG_INSENSITIVE = 1 << 3,
GTK_STATE_FLAG_INCONSISTENT = 1 << 4,
GTK_STATE_FLAG_FOCUSED = 1 << 5,
GTK_STATE_FLAG_BACKDROP = 1 << 6,
GTK_STATE_FLAG_DIR_LTR = 1 << 7,
GTK_STATE_FLAG_DIR_RTL = 1 << 8,
GTK_STATE_FLAG_LINK = 1 << 9,
GTK_STATE_FLAG_VISITED = 1 << 10,
GTK_STATE_FLAG_CHECKED = 1 << 11,
GTK_STATE_FLAG_DROP_ACTIVE = 1 << 12
} GtkStateFlags;
typedef void (* GtkMenuPositionFunc) (
GtkMenu* menu,
gint* x,
gint* y,
gboolean* push_in,
gpointer user_data
);
typedef struct _GdkRGBA
{
gdouble red;
gdouble green;
gdouble blue;
gdouble alpha;
} GdkRGBA;
typedef struct _GtkRequisition
{
gint width;
gint height;
} GtkRequisition;
typedef enum {
GTK_STYLE_CONTEXT_PRINT_NONE = 0,
GTK_STYLE_CONTEXT_PRINT_RECURSE = 1 << 0,
GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE = 1 << 1
} GtkStyleContextPrintFlags;
typedef enum
{
GTK_WRAP_NONE,
GTK_WRAP_CHAR,
GTK_WRAP_WORD,
GTK_WRAP_WORD_CHAR
} GtkWrapMode;
typedef enum
{
GTK_SHADOW_NONE,
GTK_SHADOW_IN,
GTK_SHADOW_OUT,
GTK_SHADOW_ETCHED_IN,
GTK_SHADOW_ETCHED_OUT
} GtkShadowType;
typedef enum
{
GDK_X_CURSOR = 0,
GDK_ARROW = 2,
GDK_BASED_ARROW_DOWN = 4,
GDK_BASED_ARROW_UP = 6,
GDK_BOAT = 8,
GDK_BOGOSITY = 10,
GDK_BOTTOM_LEFT_CORNER = 12,
GDK_BOTTOM_RIGHT_CORNER = 14,
GDK_BOTTOM_SIDE = 16,
GDK_BOTTOM_TEE = 18,
GDK_BOX_SPIRAL = 20,
GDK_CENTER_PTR = 22,
GDK_CIRCLE = 24,
GDK_CLOCK = 26,
GDK_COFFEE_MUG = 28,
GDK_CROSS = 30,
GDK_CROSS_REVERSE = 32,
GDK_CROSSHAIR = 34,
GDK_DIAMOND_CROSS = 36,
GDK_DOT = 38,
GDK_DOTBOX = 40,
GDK_DOUBLE_ARROW = 42,
GDK_DRAFT_LARGE = 44,
GDK_DRAFT_SMALL = 46,
GDK_DRAPED_BOX = 48,
GDK_EXCHANGE = 50,
GDK_FLEUR = 52,
GDK_GOBBLER = 54,
GDK_GUMBY = 56,
GDK_HAND1 = 58,
GDK_HAND2 = 60,
GDK_HEART = 62,
GDK_ICON = 64,
GDK_IRON_CROSS = 66,
GDK_LEFT_PTR = 68,
GDK_LEFT_SIDE = 70,
GDK_LEFT_TEE = 72,
GDK_LEFTBUTTON = 74,
GDK_LL_ANGLE = 76,
GDK_LR_ANGLE = 78,
GDK_MAN = 80,
GDK_MIDDLEBUTTON = 82,
GDK_MOUSE = 84,
GDK_PENCIL = 86,
GDK_PIRATE = 88,
GDK_PLUS = 90,
GDK_QUESTION_ARROW = 92,
GDK_RIGHT_PTR = 94,
GDK_RIGHT_SIDE = 96,
GDK_RIGHT_TEE = 98,
GDK_RIGHTBUTTON = 100,
GDK_RTL_LOGO = 102,
GDK_SAILBOAT = 104,
GDK_SB_DOWN_ARROW = 106,
GDK_SB_H_DOUBLE_ARROW = 108,
GDK_SB_LEFT_ARROW = 110,
GDK_SB_RIGHT_ARROW = 112,
GDK_SB_UP_ARROW = 114,
GDK_SB_V_DOUBLE_ARROW = 116,
GDK_SHUTTLE = 118,
GDK_SIZING = 120,
GDK_SPIDER = 122,
GDK_SPRAYCAN = 124,
GDK_STAR = 126,
GDK_TARGET = 128,
GDK_TCROSS = 130,
GDK_TOP_LEFT_ARROW = 132,
GDK_TOP_LEFT_CORNER = 134,
GDK_TOP_RIGHT_CORNER = 136,
GDK_TOP_SIDE = 138,
GDK_TOP_TEE = 140,
GDK_TREK = 142,
GDK_UL_ANGLE = 144,
GDK_UMBRELLA = 146,
GDK_UR_ANGLE = 148,
GDK_WATCH = 150,
GDK_XTERM = 152,
GDK_LAST_CURSOR,
GDK_BLANK_CURSOR = -2,
GDK_CURSOR_IS_PIXMAP = -1
} GdkCursorType;
typedef enum
{
GTK_ALIGN_FILL,
GTK_ALIGN_START,
GTK_ALIGN_END,
GTK_ALIGN_CENTER,
GTK_ALIGN_BASELINE
} GtkAlign;
typedef enum
{
GTK_DIALOG_MODAL = 1 << 0,
GTK_DIALOG_DESTROY_WITH_PARENT = 1 << 1,
GTK_DIALOG_USE_HEADER_BAR = 1 << 2
} GtkDialogFlags;
typedef enum
{
GTK_MESSAGE_INFO,
GTK_MESSAGE_WARNING,
GTK_MESSAGE_QUESTION,
GTK_MESSAGE_ERROR,
GTK_MESSAGE_OTHER
} GtkMessageType;
typedef enum
{
GTK_BUTTONS_NONE,
GTK_BUTTONS_OK,
GTK_BUTTONS_CLOSE,
GTK_BUTTONS_CANCEL,
GTK_BUTTONS_YES_NO,
GTK_BUTTONS_OK_CANCEL
} GtkButtonsType;
typedef enum
{
GTK_RESPONSE_NONE = -1,
GTK_RESPONSE_REJECT = -2,
GTK_RESPONSE_ACCEPT = -3,
GTK_RESPONSE_DELETE_EVENT = -4,
GTK_RESPONSE_OK = -5,
GTK_RESPONSE_CANCEL = -6,
GTK_RESPONSE_CLOSE = -7,
GTK_RESPONSE_YES = -8,
GTK_RESPONSE_NO = -9,
GTK_RESPONSE_APPLY = -10,
GTK_RESPONSE_HELP = -11
} GtkResponseType;
typedef struct _GdkEventFocus
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
gint16 in;
} GdkEventFocus;
typedef gboolean (*GSourceFunc) (gpointer user_data);
typedef enum
{
GDK_WINDOW_TYPE_HINT_NORMAL,
GDK_WINDOW_TYPE_HINT_DIALOG,
GDK_WINDOW_TYPE_HINT_MENU, /* Torn off menu */
GDK_WINDOW_TYPE_HINT_TOOLBAR,
GDK_WINDOW_TYPE_HINT_SPLASHSCREEN,
GDK_WINDOW_TYPE_HINT_UTILITY,
GDK_WINDOW_TYPE_HINT_DOCK,
GDK_WINDOW_TYPE_HINT_DESKTOP,
GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU, /* A drop down menu (from a menubar) */
GDK_WINDOW_TYPE_HINT_POPUP_MENU, /* A popup menu (from right-click) */
GDK_WINDOW_TYPE_HINT_TOOLTIP,
GDK_WINDOW_TYPE_HINT_NOTIFICATION,
GDK_WINDOW_TYPE_HINT_COMBO,
GDK_WINDOW_TYPE_HINT_DND
} GdkWindowTypeHint;
typedef enum
{
GDK_VISIBILITY_UNOBSCURED,
GDK_VISIBILITY_PARTIAL,
GDK_VISIBILITY_FULLY_OBSCURED
} GdkVisibilityState;
typedef struct _GdkEventVisibility
{
GdkEventType type;
GdkWindow *window;
gint8 send_event;
GdkVisibilityState state;
} GdkEventVisibility;
#define G_TYPE_FUNDAMENTAL_SHIFT (2)
#define G_TYPE_MAKE_FUNDAMENTAL(x) ((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))
#define G_TYPE_INT G_TYPE_MAKE_FUNDAMENTAL (6)
#define GTK_STYLE_PROVIDER_PRIORITY_USER 800
#endif
// GLib
DECL(GTimer*, g_timeout_add, (guint interval, GSourceFunc func, gpointer data));
// Gtk Application / Window / Widget
DECL(GtkApplication *, gtk_application_new, (const char *name, GApplicationFlags flags))
DECL(int, g_application_run, (GApplication* application, int argc, char** argv))
@@ -287,47 +588,105 @@ DECL(void, gtk_window_set_decorated, (GtkWindow* window, gboolean setting ))
DECL(void, gtk_widget_show_all, (GtkWindow *window))
DECL(void, gtk_widget_hide, (GtkWidget* widget ))
DECL(void, gtk_widget_show, (GtkWidget* widget))
DECL(gboolean, gtk_widget_grab_focus, ( GtkWidget* widget ))
DECL(GtkWidget*, gtk_event_box_new, (void))
DECL(void, gtk_event_box_set_visible_window, (GtkEventBox* event_box, gboolean visible_window ))
DECL(void, gtk_window_get_size, (GtkWindow *win, int *width, int *height))
DECL(void, gtk_window_resize, (GtkWindow* window, gint width, gint height))
DECL(void, gtk_window_set_default_size, (GtkWindow *window, gint width, gint height))
DECL(void, gtk_window_get_position, (GtkWindow* window, gint* root_x, gint* root_y))
DECL(void, gtk_window_move, (GtkWindow* window, gint x, gint y))
DECL(void, gtk_window_present, (GtkWindow* window))
DECL(void, gtk_window_set_type_hint, (GtkWindow* window, GdkWindowTypeHint hint))
DECL(void, gtk_window_set_skip_taskbar_hint, (GtkWindow* window, gboolean setting))
DECL(void, gtk_window_set_skip_pager_hint, (GtkWindow* window, gboolean setting))
DECL(void, gtk_widget_set_can_focus, (GtkWidget* widget, gboolean can_focus ))
DECL(void, gtk_window_set_transient_for, (GtkWindow* window, GtkWindow* parent ))
DECL(GType, gtk_window_get_type, (void))
DECL(GObject*, g_object_new, (GType object_type, const gchar* first_property_name, ...))
DECL(void, gtk_widget_set_size_request, (GtkWidget* widget, int width, int height ))
DECL(void, gtk_widget_get_preferred_size, (GtkWidget* widget, GtkRequisition* minimum_size, GtkRequisition* natural_size))
DECL(void, gtk_widget_get_allocation, ( GtkWidget* widget, GtkAllocation* allocation ))
DECL(void, gtk_window_set_resizable, (GtkWindow* window, gboolean resizable))
DECL(GdkWindow *, gtk_widget_get_window, (GtkWidget *w));
DECL(GdkWindow*, gdk_window_get_effective_toplevel, (GdkWindow* window))
DECL(void, gdk_window_set_override_redirect, (GdkWindow* window, gboolean override_redirect))
DECL(GtkWidget*, gtk_scrolled_window_new, (GtkAdjustment* hadjustment, GtkAdjustment* vadjustment))
DECL(gboolean, gtk_window_get_decorated, (GtkWindow* window))
DECL(void, gdk_window_set_events, (GdkWindow* window, GdkEventMask event_mask ))
DECL(GdkEventMask, gdk_window_get_events, (GdkWindow* window ))
DECL(void, gtk_window_set_title, (GtkWindow* window, const gchar* title))
DECL(const gchar*, gtk_window_get_title, (GtkWindow* window))
DECL(void, gtk_widget_destroy, (GtkWidget* widget))
DECL(void, gtk_container_add, (GtkContainer* container, GtkWidget* widget))
DECL(void, gtk_container_remove, (GtkContainer* container, GtkWidget* widget))
DECL(gboolean, gtk_widget_is_visible, (GtkWidget* widget))
DECL(GtkWidget*, gtk_label_new, (const char* str))
DECL(void, gtk_label_set_ellipsize, (GtkLabel* label, PangoEllipsizeMode mode))
DECL(void, gtk_label_set_label, (GtkLabel* label, const gchar* str))
DECL(const gchar*, gtk_label_get_text, (GtkLabel* label))
DECL(GtkWidget*, gtk_entry_new, (void))
DECL(void, gtk_entry_set_text, (GtkEntry* entry, const gchar* text ))
DECL(const gchar*, gtk_entry_get_text, (GtkEntry* entry))
DECL(GtkWidget*, gtk_separator_new, ( GtkOrientation orientation ))
DECL(GtkWidget*, gtk_frame_new, ( const gchar* label ))
DECL(void, gtk_frame_set_shadow_type, (GtkFrame* frame, GtkShadowType type ))
DECL(GtkWidget*, gtk_box_new, (GtkOrientation orientation, gint spacing ))
DECL(void, gtk_widget_set_vexpand, (GtkWidget* widget, gboolean expand ))
DECL(void, gtk_widget_set_hexpand, (GtkWidget* widget, gboolean expand ))
DECL(void, gtk_widget_set_halign, (GtkWidget* widget, GtkAlign align ))
DECL(void, gtk_widget_set_valign, (GtkWidget* widget, GtkAlign align ))
DECL(gboolean, gtk_widget_translate_coordinates, ( GtkWidget* src_widget, GtkWidget* dest_widget, gint src_x, gint src_y, gint* dest_x, gint* dest_y))
DECL(void, gtk_main, (void))
DECL(void, gtk_main_quit, (void))
DECL(unsigned long, g_signal_connect_data, (GObject *obj, const char *signal, GCallback c_handler, gpointer data, GClosureNotify destroy_data, GConnectFlags connect_flags))
// Messages
DECL(GtkWidget*, gtk_message_dialog_new, (GtkWindow* parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons, const gchar* message_format, ...))
DECL(gint, gtk_dialog_run, (GtkDialog* dialog))
// Dialogs
DECL(GtkWidget*, gtk_dialog_new, (void))
DECL(GtkWidget*, gtk_dialog_add_button, (GtkDialog* dialog, const gchar* button_text, gint response_id ))
DECL(void, gtk_dialog_response, (GtkDialog* dialog, gint response_id ))
//DECL(GtkWidget*, gtk_dialog_new_with_buttons, (const gchar* title, GtkWindow* parent, GtkDialogFlags flags, const gchar* first_button_text, ...))
//DECL(GtkWidget*, gtk_drop_down_new_from_strings, (const char* const* strings ))
DECL(GtkWidget*, gtk_combo_box_new, (void));
DECL(GtkWidget*, gtk_combo_box_text_new, (void))
DECL(void, gtk_combo_box_text_append, ( GtkComboBoxText* combo_box, const gchar* id, const gchar* text ))
DECL(GtkWidget*, gtk_dialog_get_content_area, (GtkDialog* dialog ))
DECL(gboolean, gtk_combo_box_set_active_id, ( GtkComboBox* combo_box, const gchar* active_id ))
DECL(const gchar*, gtk_combo_box_get_active_id, (GtkComboBox* combo_box))
// GObject / GValue
DECL(void, g_object_unref, (GObject* object))
DECL(void, g_object_ref, (GObject* object))
DECL(void, g_object_set_property, (GObject* object, const gchar* property_name, const GValue* value))
DECL(GValue*, g_value_init, (GValue* value, GType g_type))
DECL(void, g_value_unset, (GValue* value))
DECL(void, g_value_set_int, (GValue* value, gint v_int))
DECL(void, g_free, (gpointer mem))
// Cursors
DECL(GdkCursor*, gdk_cursor_new_from_name, (GdkDisplay* display, const gchar* name ))
DECL(GdkCursor*, gdk_cursor_new, ( GdkCursorType cursor_type ))
DECL(void, gdk_window_set_cursor, (GdkWindow* window, GdkCursor* cursor ))
// Menus
@@ -338,6 +697,8 @@ DECL(GtkMenuItem *, gtk_menu_item_new, (void));
DECL(GtkMenuItem *, gtk_menu_item_new_with_label, (const gchar *label));
DECL(void, gtk_menu_shell_append, (GtkMenuShell* menu_shell, GtkWidget* child))
DECL(GtkWidget *, gtk_separator_menu_item_new, (void))
DECL(void, gtk_menu_popup, (GtkMenu* menu, GtkWidget* parent_menu_shell, GtkWidget* parent_menu_item,
GtkMenuPositionFunc func, gpointer data, guint button, guint32 activate_time))
// Text Buffer / Widget
DECL(GtkTextBuffer*, gtk_text_buffer_new, (GtkTextTagTable* table))
@@ -347,17 +708,42 @@ DECL(void, gtk_text_buffer_get_end_iter, (GtkTextBuffer* buffer, GtkTextIter* it
DECL(GtkWidget*, gtk_text_view_new, (void))
DECL(GtkWidget*, gtk_text_view_new_with_buffer, ( GtkTextBuffer* buffer ))
DECL(void, gtk_text_buffer_set_text, (GtkTextBuffer* buffer, const gchar* text, gint len ))
DECL(void, gtk_text_view_set_wrap_mode, (GtkTextView* text_view, GtkWrapMode wrap_mode ))
// Titlebar
DECL(GtkWidget*, gtk_header_bar_new, (void))
DECL(void, gtk_header_bar_set_custom_title, (GtkHeaderBar* bar, GtkWidget* title_widget))
// Deprecated in Gtk3
// Image
DECL(GtkWidget*, gtk_image_new_from_file, (const char* filename ))
DECL(GtkWidget*, gtk_image_new_from_pixbuf, (GdkPixbuf* pixbuf ))
DECL(void, gtk_image_set_from_pixbuf, ( GtkImage* image, GdkPixbuf* pixbuf ))
DECL(GdkPixbuf*, gdk_pixbuf_new_from_file, (const char* filename, GError** error))
DECL(GdkPixbuf*, gdk_pixbuf_new_from_file_at_size, (const char* filename, int width, int height, GError** error))
// Styles
DECL(GtkStyleContext*, gtk_widget_get_style_context, (GtkWidget* widget))
DECL(char*, gtk_style_context_to_string, (GtkStyleContext* context, GtkStyleContextPrintFlags flags))
DECL(GtkCssProvider*, gtk_css_provider_new, (void))
DECL(gboolean, gtk_css_provider_load_from_data, (GtkCssProvider* css_provider, const gchar* data, gssize length, GError** error))
DECL(void, gtk_style_context_add_provider, (GtkStyleContext* context, GtkStyleProvider* provider, guint priority))
DECL(const GtkWidgetPath*, gtk_style_context_get_path, (GtkStyleContext* context))
DECL(char*, gtk_widget_path_to_string, (const GtkWidgetPath* path))
// Deprecated in Gtk3
DECL(GtkStatusIcon*, gtk_status_icon_new, (void ))
DECL(GtkStatusIcon*, gtk_status_icon_new_from_file, (const gchar* filename))
DECL(void, gtk_widget_override_background_color, (GtkWidget* widget, GtkStateFlags state, const GdkRGBA* color))
DECL(void, gtk_window_set_has_resize_grip, (GtkWindow* window, gboolean value ))
#define g_signal_connect(instance, signal, c_handler, data) \
g_signal_connect_data(instance, signal, reinterpret_cast<void *>(c_handler), data, NULL, G_CONNECT_DEFAULT)
// WIN32
#ifdef _WIN32
#include <windows.h>
DECL(HWND, gdk_win32_window_get_handle, (GdkWindow *window));
#endif
#endif // GTK_IMPORTS_H

View File

@@ -105,6 +105,8 @@ void GtkLoader::dlopen()
"gtk-3-vs17",
"glib-2.0-0",
"gio-2.0-0",
"gdk-3-vs17",
"gdk_pixbuf-2.0-0",
NULL
};
int i;

BIN
hide.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

27
hide.svg Normal file
View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg fill="#000000" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="800px" height="800px" viewBox="0 0 572.098 572.098"
xml:space="preserve">
<g>
<g>
<path d="M99.187,398.999l44.333-44.332c-24.89-15.037-47.503-33.984-66.763-56.379c29.187-33.941,66.053-60.018,106.947-76.426
c-6.279,14.002-9.853,29.486-9.853,45.827c0,16.597,3.696,32.3,10.165,46.476l35.802-35.797
c-5.698-5.594-9.248-13.36-9.248-21.977c0-17.02,13.801-30.82,30.82-30.82c8.611,0,16.383,3.55,21.971,9.248l32.534-32.534
l36.635-36.628l18.366-18.373c-21.206-4.186-42.896-6.469-64.848-6.469c-107.663,0-209.732,52.155-273.038,139.518L0,298.288
l13.011,17.957C36.83,349.116,66.151,376.999,99.187,398.999z"/>
<path d="M459.208,188.998l-44.854,44.854c30.539,16.071,58.115,37.846,80.986,64.437
c-52.167,60.662-128.826,96.273-209.292,96.273c-10.3,0-20.533-0.6-30.661-1.744l-52.375,52.375
c26.903,6.887,54.762,10.57,83.036,10.57c107.663,0,209.738-52.154,273.038-139.523l13.011-17.957l-13.011-17.956
C532.023,242.995,497.844,212.15,459.208,188.998z"/>
<path d="M286.049,379.888c61.965,0,112.198-50.234,112.198-112.199c0-5.588-0.545-11.035-1.335-16.402L269.647,378.56
C275.015,379.349,280.461,379.888,286.049,379.888z"/>
<path d="M248.815,373.431L391.79,230.455l4.994-4.994l45.796-45.796l86.764-86.77c13.543-13.543,13.543-35.502,0-49.046
c-6.77-6.769-15.649-10.159-24.523-10.159s-17.754,3.384-24.522,10.159l-108.33,108.336l-22.772,22.772l-29.248,29.248
l-48.14,48.14l-34.456,34.456l-44.027,44.027l-33.115,33.115l-45.056,45.055l-70.208,70.203
c-13.543,13.543-13.543,35.502,0,49.045c6.769,6.77,15.649,10.16,24.523,10.16s17.754-3.385,24.523-10.16l88.899-88.898
l50.086-50.086L248.815,373.431z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -14,7 +14,8 @@ static void activate (GtkApplication* app, gpointer user_data)
GtkWidget *window;
YellowNotes *notes = YELLOWNOTES(user_data);
GtkStatusIcon *tray = gtk_status_icon_new_from_file(notes->imageFile("yellownotes.svg").c_str());
std::string img_file = notes->imageFile("yellownotes");
GtkStatusIcon *tray = gtk_status_icon_new_from_file(img_file.c_str());
g_signal_connect(tray, "activate", on_tray_activate, notes);
}
@@ -22,6 +23,8 @@ int main(int argc, char **argv)
{
GtkLoader l;
srand(time(NULL)); // seed with current time
try {
l.loadGtk();
} catch(std::string msg) {

BIN
plus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

4
plus.svg Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg fill="#000000" width="800px" height="800px" viewBox="0 0 256 256" id="Flat" xmlns="http://www.w3.org/2000/svg">
<path d="M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"/>
</svg>

After

Width:  |  Height:  |  Size: 381 B

94
tr.cpp Normal file
View File

@@ -0,0 +1,94 @@
#include "tr.h"
#include <stdarg.h>
void tr::add(const char *sentence, ...)
{
va_list args;
va_start(args, sentence);
std::string sent(sentence);
const char *tr = va_arg(args, char *);
while (tr != nullptr) {
std::string t(tr);
size_t pos = t.find(":");
std::string lang = t.substr(0, pos);
std::string str = t.substr(pos + 1);
std::unordered_map<std::string, Translations_t *>::iterator it;
it = _translations.find(lang);
if (it != _translations.end()) {
Translations_t *m = it->second;
std::pair p = { sent, str };
m->insert(p);
} else {
Translations_t *m = new Translations_t();
std::pair p = { sent, str };
m->insert(p);
std::pair lp = { lang, m };
_translations.insert(lp);
}
tr = va_arg(args, char *);
}
va_end(args);
}
const char *tr::translate(const char *str)
{
std::unordered_map<std::string, Translations_t *>::iterator it;
it = _translations.find(_lang);
if (it == _translations.end()) {
return str;
} else {
Translations_t *m = it->second;
Translations_t::iterator n_it;
std::string s(str);
n_it = m->find(s);
if (n_it == m->end()) {
return str;
} else {
return n_it->second.c_str();
}
}
}
void tr::setLang(const std::string &l)
{
_lang = l;
}
tr::tr()
{
add("Quit", "nl:Beëindigen", nullptr);
add("New Note", "nl:Nieuwe Notitie", nullptr);
add("Show Notes", "nl:Notities Presenteren", nullptr);
add("Hide Notes", "nl:Notities Verbergen", nullptr);
add("Reload Notes", "nl:Notities opnieuw laden", nullptr);
add("Setup", "nl:Instellingen", nullptr);
_lang = "en";
}
static tr *_t = nullptr;
static void init()
{
if (_t == nullptr) {
_t = new tr();
}
}
const char *_(const char *str)
{
init();
return _t->translate(str);
}
void setLang(const std::string &lang)
{
init();
_t->setLang(lang);
}

31
tr.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef TR_H
#define TR_H
#include <string>
#include <unordered_map>
typedef std::unordered_map<std::string, std::string> Translations_t;
class tr
{
private:
std::unordered_map<std::string, Translations_t *> _translations;
std::string _lang;
private:
void add(const char *sentence, ...);
public:
const char *translate(const char *str);
public:
void setLang(const std::string &l);
public:
tr();
};
const char *_(const char *str);
void setLang(const std::string &lang);
#endif // TR_H

File diff suppressed because it is too large Load Diff

View File

@@ -3,15 +3,43 @@
#include <string>
#include <list>
#include <unordered_map>
extern "C" {
#include "gtk-imports.h"
}
class YellowNote;
typedef enum {
DARK = 0,
FIRST= DARK,
YELLOW,
ORANGE,
BLUE,
CYAAN,
GREEN,
RED,
GREY,
LAST = GREY
} ColorType_t;
class YellowNotes
{
private:
void *_tray_menu;
void *_app;
void *_dlg;
void *_langs;
std::list<YellowNote *> _notes;
int _font_size;
GtkWindow *_toplevel;
std::unordered_map<std::string, std::string> _cfg;
private:
void loadConfig();
void saveConfig();
public:
void loadNotes();
@@ -21,11 +49,27 @@ public:
std::string imageFile(const char *name);
std::string appDir();
std::string notesDir();
std::string css(ColorType_t type);
int fontSize();
int iconSize();
GtkWindow *topLevel();
public:
void popupTrayMenu();
void newNote();
void quit();
void popupTrayMenu(void *sender);
void newNote(void *sender);
void showNotes(void *sender);
void reloadNotes(void *sender);
void quit(void *sender);
void topLevelHidden(GtkWidget *sender);
void setup(void *sender);
void setupClose(GtkWidget *sender);
void setupCancel(GtkWidget *sender);
bool setupDel(GtkWidget *sender, void *evt);
void remove(YellowNote *n);
public:
std::string currentLang();
void setCurrentLang(const std::string &l);
public:
YellowNotes(void *app);
@@ -34,12 +78,15 @@ public:
#define YELLOWNOTES(obj) reinterpret_cast<YellowNotes *>(obj)
#define SIGNAL(type, func, member) \
static void func(GObject *obj, gpointer user_data) { type *o = reinterpret_cast<type *>(user_data); o->member(); }
static void func(GObject *obj, gpointer user_data) { type *o = reinterpret_cast<type *>(user_data); o->member(obj); }
#define BSIGNAL(type, func, member) \
static gboolean func(GObject *obj, gpointer user_data) { std::cout << user_data << std::endl; type *o = reinterpret_cast<type *>(user_data); return o->member(obj); }
#define SIGNAL2(type, func, member, argtype) \
static void func(GObject *obj, void *arg, gpointer user_data) { type *o = reinterpret_cast<type *>(user_data); o->member(reinterpret_cast<argtype *>(arg)); }
static void func(GObject *obj, void *arg, gpointer user_data) { type *o = reinterpret_cast<type *>(user_data); o->member(obj, reinterpret_cast<argtype *>(arg)); }
#define BSIGNAL2(type, func, member, argtype) \
static gboolean func(GObject *obj, void *arg, gpointer user_data) { type *o = reinterpret_cast<type *>(user_data); return o->member(reinterpret_cast<argtype *>(arg)); }
static gboolean func(GObject *obj, void *arg, gpointer user_data) { type *o = reinterpret_cast<type *>(user_data); return o->member(obj, reinterpret_cast<argtype *>(arg)); }
#endif // YELLOWNOTES_H