133 lines
3.8 KiB
C
133 lines
3.8 KiB
C
/*
|
|
* JoeyDev
|
|
* Copyright (C) 2018-2023 Scott Duensing <scott@kangaroopunch.com>
|
|
*
|
|
* This software is provided 'as-is', without any express or implied
|
|
* warranty. In no event will the authors be held liable for any damages
|
|
* arising from the use of this software.
|
|
*
|
|
* Permission is granted to anyone to use this software for any purpose,
|
|
* including commercial applications, and to alter it and redistribute it
|
|
* freely, subject to the following restrictions:
|
|
*
|
|
* 1. The origin of this software must not be misrepresented; you must not
|
|
* claim that you wrote the original software. If you use this software
|
|
* in a product, an acknowledgment in the product documentation would be
|
|
* appreciated but is not required.
|
|
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
* misrepresented as being the original software.
|
|
* 3. This notice may not be removed or altered from any source distribution.
|
|
*/
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "common.h"
|
|
#include "utils.h"
|
|
#include "project.h"
|
|
#include "editor.h"
|
|
#include "vector.h"
|
|
#include "joeydev.h"
|
|
|
|
|
|
static GtkWidget *_winJoeyDev = NULL;
|
|
|
|
|
|
EVENT void toolJoeyDevAboutClicked(GtkWidget *widget, gpointer userData);
|
|
EVENT void toolJoeyDevEditorClicked(GtkWidget *widget, gpointer userData);
|
|
EVENT void toolJoeyDevProjectClicked(GtkWidget *widget, gpointer userData);
|
|
EVENT void toolJoeyDevQuitClicked(GtkWidget *widget, gpointer userData);
|
|
EVENT void toolJoeyDevVectorClicked(GtkWidget *widget, gpointer userData);
|
|
EVENT gboolean winJoeyDevClose(GtkWidget *widget, gpointer userData);
|
|
|
|
|
|
EVENT void toolJoeyDevAboutClicked(GtkWidget *widget, gpointer userData) {
|
|
GtkWidget *dialog;
|
|
GdkPixbuf *pixbuf;
|
|
|
|
(void)widget;
|
|
(void)userData;
|
|
|
|
pixbuf = gdk_pixbuf_new_from_resource("/com/kangaroopunch/joeydev/Logo.png", NULL);
|
|
|
|
dialog = gtk_about_dialog_new();
|
|
gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(dialog), "JoeyDev");
|
|
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), JOEYDEV_VERSION);
|
|
gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog),"Copyright (C) 2018-2023 Scott Duensing");
|
|
gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog), "Development Environment for JoeyLib.");
|
|
gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog), "https://JoeyLib.com");
|
|
gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(dialog), pixbuf);
|
|
|
|
g_object_unref(pixbuf);
|
|
pixbuf = NULL;
|
|
|
|
gtk_dialog_run(GTK_DIALOG(dialog));
|
|
gtk_widget_destroy(dialog);
|
|
}
|
|
|
|
|
|
EVENT void toolJoeyDevEditorClicked(GtkWidget *widget, gpointer userData) {
|
|
(void)widget;
|
|
(void)userData;
|
|
|
|
winEditorCreate();
|
|
}
|
|
|
|
|
|
EVENT void toolJoeyDevProjectClicked(GtkWidget *widget, gpointer userData) {
|
|
(void)widget;
|
|
(void)userData;
|
|
|
|
winProjectCreate();
|
|
}
|
|
|
|
|
|
EVENT void toolJoeyDevQuitClicked(GtkWidget *widget, gpointer userData) {
|
|
winJoeyDevClose(widget, userData);
|
|
}
|
|
|
|
|
|
EVENT void toolJoeyDevVectorClicked(GtkWidget *widget, gpointer userData) {
|
|
(void)widget;
|
|
(void)userData;
|
|
|
|
winVectorCreate(NULL);
|
|
}
|
|
|
|
|
|
EVENT gboolean winJoeyDevClose(GtkWidget *widget, gpointer userData) {
|
|
(void)userData;
|
|
|
|
// Do they want to quit?
|
|
if (utilQuestionDialog(_winJoeyDev, "Exit", "Are you sure you wish to exit JoeyDev?") == FALSE) return TRUE;
|
|
|
|
// Are all editors closed?
|
|
if (utilWindowsCloseAll() > 0) return TRUE;
|
|
|
|
// Quit!
|
|
gtk_main_quit();
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
void winJoeyDevCreate(void) {
|
|
GtkWidget *toolJoeyDevProject;
|
|
char *widgetNames[] = {
|
|
"winJoeyDev",
|
|
"toolJoeyDevProject",
|
|
NULL
|
|
};
|
|
GtkWidget **widgets[] = {
|
|
&_winJoeyDev,
|
|
&toolJoeyDevProject
|
|
};
|
|
|
|
utilGetWidgetsFromMemory("/com/kangaroopunch/joeydev/JoeyDev.glade", widgetNames, widgets, NULL);
|
|
|
|
#ifndef DEBUG_MODE
|
|
// Don't enable the project tool if we're not debugging.
|
|
// gtk_widget_set_sensitive(GTK_WIDGET(toolJoeyDevProject), FALSE);
|
|
#endif
|
|
|
|
gtk_widget_show_all(_winJoeyDev);
|
|
}
|