/* ui.h
 * This file is part of Amsam photo cropping program
 * Copyright 2021, 2023, 2024, 2025, 2026 Nandakumar Edamana
 * Distributed under GNU General Public License, version 3
 */ 

#ifndef N96_DRAW_ui_h
#define N96_DRAW_ui_h

typedef struct Image Image;
typedef struct CommandLineOptions CommandLineOptions;
typedef struct SimpleHelpItem SimpleHelpItem;
typedef struct Ratio Ratio;
typedef struct _ngg_tuple_myapp__get_outdims _ngg_tuple_myapp__get_outdims;
typedef struct _ngg_tuple_myapp__get_outrect _ngg_tuple_myapp__get_outrect;
typedef struct myapp myapp;
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "doc.h"
#include "brushes.h"
#include "defaults.h"
#include "helpmenuitem.h"
#include "imageview.h"
#include "inputdialog.h"
#include "jpeg-read.h"
#include "jpeg-write.h"
#include "newdocdialog.h"
#include "ui-icons.h"
#include <cairo.h>
#define PROGRAM_NAME ("Amsam")
#define VERSION ("0.1.260620")
#define DEFWIDTH_MWND (1200)
#define DEFHEIGHT_MWND (700)
#define DEFWIDTH_CAIRO (1920)
#define DEFHEIGHT_CAIRO (1080)
#define MINWIDTH_MWND (1024)
#define MINHEIGHT_MWND (400)
#define MINWIDTH_LBL_BRUSH_SIZE (24)
#define MINWIDTH_LBL_ZOOM_SIZE (48)
struct CommandLineOptions {
	_Bool static_cursor;
};
extern CommandLineOptions clopts;
extern double ZOOMSTEP;
#define MAXWIDTH (4096)
struct SimpleHelpItem {
	const char *title;
	const char *message;
};
extern SimpleHelpItem helpitems[1];
struct Ratio {
	int width;
	int height;
	const char *label;
	const char *tooltip;
	GtkRadioButton *button;
};
extern Ratio ratios[8];
struct _ngg_tuple_myapp__get_outdims {
	int m0;
	int m1;
};
struct _ngg_tuple_myapp__get_outrect {
	int m0;
	int m1;
	int m2;
	int m3;
};
struct myapp {
	GtkSpinButton *spn_custrat;
	GtkSpinButton *spn_custh;
	GtkSpinButton *spn_custw;
	GtkRadioButton *btn_ratio_custrat;
	GtkRadioButton *btn_ratio_custdim;
	GtkDrawingArea *da;
	GtkGrid *grd_viewport;
	GtkButton *btn_export_doc;
	GtkBox *hbx_export;
	GtkLabel *lbl_curdims;
	GtkRadioButton *btn_ratio_original;
	GtkBox *box_ratios;
	GtkBox *hbx_toolbar;
	GtkMenuItem *mni_help_about;
	GtkMenuItem *mni_help_topics;
	GtkMenu *mnu_help;
	GtkMenuItem *mni_help;
	GtkMenuItem *mni_file_quit;
	GtkSeparatorMenuItem *mnisep_file_1;
	GtkMenuItem *mni_file_export;
	GtkMenuItem *mni_file_open;
	GtkMenu *mnu_file;
	GtkMenuItem *mni_file;
	GtkMenuBar *mbr;
	GtkBox *box_main;
	GtkAccelGroup *accgrp;
	GtkWindow *wnd;
	_Bool was_autoscroll;
	_Bool disable_brush_preview;
	int test_vara_logo_size;
	_Bool test_vara_logo_exit;
	ImageView *ivw_ballpoint;
	ImageView *ivw_charcoal;
	ImageView *ivw_crayon;
	ImageView *ivw_pencil;
	ImageView *ivw_round;
	ImageView *ivw_round_pressure_size;
	ImageView *ivw_soft_round;
	int layerstack_version;
	_Bool updating_lst_layers;
	ProxyDocument *proxydoc;
	cairo_surface_t *surf;
	int curratiow;
	int curratioh;
};
void myapp_construct(myapp *this, const char *infile_path);
_Bool myapp_can_zoom_in(myapp *this);
_Bool myapp_can_zoom_out(myapp *this);
_Bool myapp_prompt_close_document(myapp *this);
void myapp_reflect_brush_status(myapp *this);
void myapp_reflect_document_state(myapp *this);
void myapp_reflect_layer_status(myapp *this);
void myapp_reflect_tool_status(myapp *this);
void myapp_set_document(myapp *this, ProxyDocument *newdoc);
void myapp_after_set_document(myapp *this);
void myapp_apply_custdim(myapp *this);
void myapp_on_spn_custdim_changed(GtkSpinButton *widget, void *user_data);
void myapp_apply_custrat(myapp *this);
void myapp_on_spn_custrat_changed(GtkSpinButton *widget, void *user_data);
void myapp_on_btn_layer_delete_clicked(GtkToolButton *widget, void *user_data);
void myapp_on_btn_layer_move_down_clicked(GtkToolButton *widget, void *user_data);
void myapp_on_btn_layer_move_up_clicked(GtkToolButton *widget, void *user_data);
void myapp_on_btn_layer_new_clicked(GtkToolButton *widget, void *user_data);
void myapp_on_btn_layer_rename_clicked(GtkToolButton *widget, void *user_data);
void myapp_on_btn_tool_x_toggled(GtkCheckButton *widget, void *user_data);
void myapp_on_mni_file_open_activate(GtkMenuItem *widget, void *user_data);
void myapp_on_mni_file_quit_activate(GtkMenuItem *widget, void *user_data);
void myapp_on_chk_pressure_toggled(GtkCheckButton *widget, void *user_data);
void myapp_on_btn_xlayer_toggled(GtkCheckButton *widget, void *user_data);
void myapp_on_btn_clear_layer_clicked(GtkButton *widget, void *user_data);
void myapp_handle_fileio_err(myapp *this, VaraFileIOError err, _Bool saving);
_ngg_tuple_myapp__get_outrect myapp_get_outrect(myapp *this, RawJpegDocument *rawdoc);
_ngg_tuple_myapp__get_outdims myapp_get_outdims(myapp *this, RawJpegDocument *rawdoc);
void myapp_on_btn_export_doc_clicked(GtkButton *widget, void *user_data);
void myapp_on_btn_export_layer_clicked(GtkButton *widget, void *user_data);
char * myapp_prompt_for_export_filename(myapp *this);
char * myapp_prompt_for_open_filename(myapp *this);
void myapp_on_da_sizeallocate(GtkDrawingArea *widget, GdkRectangle *nggevent_allocation, void *user_data);
void myapp_pick_ratio(myapp *this, int w, int h);
void myapp_reserve_cairo_surface(myapp *this, int w, int h);
VaraRect myapp_copy_preview_to_cairo_surface(myapp *this);
void myapp_clear_cairo_surface(myapp *this);
void myapp_drawframe(myapp *this);
void myapp_drawframe_noskip(myapp *this);
void myapp_on_mni_help_about_activate(GtkMenuItem *widget, void *user_data);
void myapp_repreview_brush(myapp *this);
void myapp_destruct(myapp *this);
void on_da_paint(GtkWidget *w, cairo_t *cr, myapp *app);
_Bool on_wnd_deleteevent(GtkWidget *wgt, GdkEvent *event, myapp *app);
void draw_brush_preview(Image *img, DrawingParams dpcopy, _Bool dot_only);
ImageView * brushpreview_widget_new(BrushParams brushparams);
_Bool probably_inside_container();
char * append_ext_if_needed_and_possible(const char *fnam, const char *ext);
char * append_png_if_needed_and_possible(const char *fnam);
char * append_jpg_if_needed_and_possible(const char *fnam);
void set_tool_icon(GtkButton *btn, Image *img);
ProxyDocument * read_proxy_document_from_file(const char *path);
CommandLineOptions command_line_options_default();
SimpleHelpItem simple_help_item_default();
_ngg_tuple_myapp__get_outdims _ngg_tuple_myapp__get_outdims_default();
_ngg_tuple_myapp__get_outrect _ngg_tuple_myapp__get_outrect_default();

#endif /* N96_DRAW_ui_h */
