Ejemplo n.º 1
0
void taninitstart(void){

  int i;

  for (i = PXSTART; i<PXNBR+PXSTART; i++){
    tabpxnam[i] = NULL;
    tabpxpx[i] = NULL;
  }

  for (i = 0; i<GCNBR; i++)
    tabcolalloc[i] = FALSE;

  editmode = FALSE;
  figgrande = figuredebut;
  figtabsize = 0;

  tansetnewfigurepart1(-1);

  tansetdefconfig();

  tanclampgrandefig();


  boardRootItem = goo_canvas_group_new (goo_canvas_get_root_item(gcomprisBoard->canvas),
					NULL);


  create_mainwindow(boardRootItem);

  tanloadfigtab(figfilename);

}
Ejemplo n.º 2
0
int main(int argc, char **argv)
{
	lp_ctx = loadparm_init(NULL);
	lp_load_default(lp_ctx);
	setup_logging(argv[0], DEBUG_STDERR);

	dcerpc_init(lp_ctx);

	ev_ctx = tevent_context_init(lp_ctx);
	gtk_init(&argc, &argv);
	mainwin = create_mainwindow();
	gtk_widget_show_all(mainwin);

	return gtk_event_loop();
}
Ejemplo n.º 3
0
Archivo: start.c Proyecto: y20k/ezeedo
/**
 * Shows default first window of Ezeedo
 */
void
activate (GtkApplication *app,
          gpointer        user_data)
{
    // get ezeedo from user data
    ezeedo_wrapper_structure *ezeedo;
    ezeedo = user_data;

    // define widgets
    GtkWidget *window;
    GtkWidget *todo_showall;
    GtkWidget *todo_contexts;
    GtkWidget *todo_projects;
    GtkWidget *donelist;
    GtkWidget *todolist;

    // initialize textlist and add to ezeedo wrapper structure
    textlist_container *main_textlist = calloc (1, sizeof(textlist_container));
    ezeedo->textlist = main_textlist;

    // initialize tasklist and add to ezeedo wrapper structure
    tasklist_container *main_tasklist = calloc (1, sizeof(tasklist_container));
    ezeedo->tasklist = main_tasklist;

    // initialize context_list and add to ezeedo wrapper structure
    category_container *context_list = calloc (1, sizeof(category_container));
    ezeedo->context_list = context_list;

    // initialize project_list and add to ezeedo wrapper structure
    category_container *project_list = calloc (1, sizeof(category_container));
    ezeedo->project_list = project_list;

    // initialize tasks store and add to ezeedo wrapper structure
    GtkListStore *tasks_store = create_tasks_store ();
    ezeedo->tasks_store = tasks_store;


    // create main window for application
    window = create_mainwindow (ezeedo);


    // get todotxt file from gsettings store
    GSettings     *settings;
    gchar *todotxt_file;
    settings     = g_settings_new        ("org.y20k.ezeedo");
    todotxt_file = g_settings_get_string (settings,
                                          "todo-txt-file");
    g_object_unref (settings);

    // if not in gsettings store get todotxt file from file chooser 
    if (strlen(todotxt_file) == 0)
    {
        todotxt_file = open_file_dialog (G_APPLICATION(ezeedo->application));
        // quit application if open file dialog returns NULL
        if (todotxt_file == NULL)
        {
            char text[INFODIALOGLENGTH];
            snprintf (text, INFODIALOGLENGTH,"File chooser returned NULL.");
            show_info (GTK_WIDGET(window),
                       text,
                       true);
            terminate (ezeedo);
        }
        else
        {
            save_file_name_location (todotxt_file);
        }
    }

    // open todo.txt file and load it line by line into a raw text list
    gboolean file_loaded = load_tasklist_file (todotxt_file,
                                               main_textlist);
    if (!file_loaded)
    {
        char text[INFODIALOGLENGTH];
        snprintf (text, INFODIALOGLENGTH,"Could not load file:\n%s", todotxt_file);
        show_info (GTK_WIDGET(window),
                   text,
                   true);
        select_and_save_file (NULL,
                              GTK_APPLICATION(ezeedo->application));
    }

    // parse the raw textlist and load it into the main tasklist and sort it
    gboolean textlist_parsed = parse_textlist (main_textlist,
                                               main_tasklist,
                                               context_list,
                                               project_list);
    if (!textlist_parsed)
    {
        char text[INFODIALOGLENGTH];
        snprintf (text, INFODIALOGLENGTH,"Could not parse file:\n%s", todotxt_file);
        show_info (GTK_WIDGET(window),
                   text,
                   true);
        select_and_save_file (NULL,
                              GTK_APPLICATION(ezeedo->application));
    }
    sort_tasklist (main_tasklist);


    // fill tasks store
    fill_tasks_store (ezeedo);

    GtkTreeModel *filter_todo;
    filter_todo = gtk_tree_model_filter_new (GTK_TREE_MODEL(ezeedo->tasks_store),
                                             NULL);
    gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER(filter_todo),
                                              TASK_NOTCOMPLETED);
 
    GtkTreeModel *filter_done;
    filter_done = gtk_tree_model_filter_new (GTK_TREE_MODEL(ezeedo->tasks_store),
                                             NULL );
    gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER(filter_done),
                                              TASK_COMPLETED);


    // create todolist widget and add to ezeedo wrapper structure
    todolist = build_tasklist (ezeedo,
                               GTK_TREE_MODEL(filter_todo));
    gtk_container_add (GTK_CONTAINER (ezeedo->todolist_box),
                       todolist);
    ezeedo->todolist = todolist;
    /* note to self: better use show_tasklist
    show_tasklist (ezeedo,
                   CATEGORYLIST_ALL
                   -1);*/

    // create donelist and add to ezeedo wrapper structure
    donelist = build_tasklist (ezeedo,
                               GTK_TREE_MODEL(filter_done));
    gtk_container_add (GTK_CONTAINER (ezeedo->donelist_box),
                       donelist);
    ezeedo->donelist = donelist;


    // create showall and add to ezeedo wrapper structure
    todo_showall  = build_show_all (ezeedo);
    gtk_container_add (GTK_CONTAINER(ezeedo->categories_box),
                       todo_showall);
    ezeedo->todo_showall  = todo_showall;


    // create contexts and add to ezeedo wrapper structure
    GtkTreeModel *filter_contexts;
    filter_contexts = fill_category_store (ezeedo,
                                           ezeedo->context_list,
                                           CATEGORYLIST_CONTEXTS);
    todo_contexts = build_categorylist (ezeedo,
                                        GTK_TREE_MODEL(filter_contexts),
                                        "Contexts");
    gtk_container_add (GTK_CONTAINER(ezeedo->categories_box),
                       todo_contexts);
    ezeedo->todo_contexts = todo_contexts;


    // create projects and add to ezeedo wrapper structure
    GtkTreeModel *filter_projects;
    filter_projects = fill_category_store (ezeedo,
                                           ezeedo->project_list,
                                           CATEGORYLIST_PROJECTS);
    todo_projects = build_categorylist (ezeedo,
                                        GTK_TREE_MODEL(filter_projects),
                                        "Projects");
    gtk_widget_set_vexpand (todo_projects,
                            true);
    gtk_container_add (GTK_CONTAINER(ezeedo->categories_box),
                       todo_projects);
    ezeedo->todo_projects = todo_projects; 


    // show main window
    gtk_widget_show_all (window);


    return;
}
Ejemplo n.º 4
0
int main(int argc, char *argv[]) {
    CustomData data[NUM_PLAYERS];
    GtkWidget *main_window;
    GtkWidget *main_grid;
    GIOChannel *io_joystick;
    GError *error = NULL;

    gboolean fullscreen = FALSE;
    int autoconnect = 0;

    GOptionEntry option_entries[] = {
        { "fullscreen", 'f', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
            &fullscreen, "Fullscreen", NULL },
        { "autoconnect", 'a', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
            &autoconnect, "Autoconnect to jackd", NULL },
        { "green", 'g', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
            &green, "Background colour until 50\% elapsed", "#00ff00" },
        { "yellow", 'y', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
            &yellow, "Background colour until 75\% elapsed", "#ffff00" },
        { "red", 'r', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
            &red, "Background colour until 100\% elapsed", "#ff0000" },
        { NULL, ' ', 0, 0, NULL, NULL, NULL }
    };

    /* Initialize GTK */
    if ( gtk_init_with_args (&argc, &argv, NULL, option_entries, NULL, &error) != TRUE )
    {
        if (error != NULL) {
            g_fprintf(stderr, "%s\nTry --help to see a full list of available command line options.\n",
                error->message);
            g_error_free(error);
        }
        return 1;
    }

    /* Initialize GStreamer */
    gst_init (&argc, &argv);

    /* Initialize our data structure */
    memset (&data, 0, sizeof (data));

    main_window = create_mainwindow();

    main_grid = gtk_grid_new();

    /* Load config */
    load_configfile(data);


    gtk_grid_set_row_spacing (GTK_GRID (main_grid), 30);
    gtk_grid_set_column_spacing (GTK_GRID (main_grid), 30);

    for (int i=0; i < NUM_PLAYERS; i++) {
        GtkWidget *playerUI = init_player (&data[i], i, autoconnect);
        data[i].mainwindow = main_window;

        /* two columns (i%2) in (i/2) rows */
        gtk_grid_attach (GTK_GRID (main_grid), playerUI, i % 2, i / 2, 1, 1);
    }

    /* force main_grid to be homogeneous, so all player UIs remain stable
     * and don't resize unintentionally (e.g., when selecting a long
     * filename in the filechooser)
     */
    gtk_grid_set_row_homogeneous(GTK_GRID (main_grid), TRUE);
    gtk_grid_set_column_homogeneous(GTK_GRID (main_grid), TRUE);

    gtk_container_add (GTK_CONTAINER (main_window), main_grid);

    if (TRUE == fullscreen) {
        gtk_window_fullscreen (GTK_WINDOW (main_window));
    } else {
        gtk_window_maximize (GTK_WINDOW (main_window));
    }

    gtk_widget_show_all (main_window);

    {
            /* ugly hack to expose the jack ports until jackaudiosink is fixed */
            gchar *tmpfileuri = make_silence();

            /* enable file selection signals */
            for (int i=0; i < NUM_PLAYERS; i++) {
                    g_signal_handler_unblock (data[i].filechooser,
                                    data[i].file_selection_signal_id);
                    audio_set_uri(&data[i], tmpfileuri);
                    audio_pause_player(&data[i]);
            }

            g_free (tmpfileuri);
    }


    create_hotkeys(main_window, data);

    io_joystick = create_joystick(data);

    /* Start the GTK main loop. We will not regain control until gtk_main_quit is called. */
    gtk_main ();

    if (NULL != io_joystick) {
        g_io_channel_shutdown (io_joystick, FALSE, NULL);
        g_io_channel_unref (io_joystick);
    }


    save_configfile (data);

    /* Free resources */
    for (int i=0; i < NUM_PLAYERS; i++) {
        gst_element_set_state (data[i].pipeline, GST_STATE_NULL);
        gst_object_unref (data[i].pipeline);
    }
    return 0;
}
Ejemplo n.º 5
0
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	MSG msg;
    INITCOMMONCONTROLSEX ctrls;
	HACCEL haccel;
	static char *class_name="DB_UTIL_CLASS";
	int first_instance=TRUE;
	int debug=0;

	first_instance=set_single_instance(TRUE);

	ghinstance=hInstance;
	init_ini_file();

#ifdef _DEBUG
	debug=1;
#else
	get_ini_value("SETTINGS","DEBUG",&debug);
#endif
	if(debug!=0){
		open_console();
	}

	{
		int val=0;
		get_ini_value("SETTINGS","SINGLE_INSTANCE",&val);
		if(val && (!first_instance)){
			COPYDATASTRUCT cd={0};
			HWND hdbutil;
			cd.cbData=nCmdShow;
			cd.cbData=strlen(lpCmdLine)+1;
			cd.lpData=lpCmdLine;
			hdbutil=FindWindow("DB_UTIL_CLASS",NULL);
			if(hdbutil!=0){
				int sw;
				SendMessage(hdbutil,WM_COPYDATA,hInstance,&cd);
				if (IsZoomed(hdbutil))
					sw=SW_MAXIMIZE;
				else if(IsIconic(hdbutil))
					sw=SW_RESTORE;
				else
					sw=SW_SHOW;
				ShowWindow(hdbutil,sw);
				SetForegroundWindow(hdbutil);
			}
			return TRUE;
		}
		set_single_instance(val);
	}
	init_mdi_stuff();

	LoadLibrary("RICHED20.DLL");
	LoadLibrary("Msftedit.dll");

	ctrls.dwSize=sizeof(ctrls);
    ctrls.dwICC = ICC_LISTVIEW_CLASSES|ICC_TREEVIEW_CLASSES|ICC_BAR_CLASSES;
	InitCommonControlsEx(&ctrls);
	
	InitializeCriticalSection(&mutex);

	start_worker_thread();
	start_intellisense_thread();

	setup_mdi_classes(ghinstance);
	
	ghmenu=LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU1));
	ghmainframe=create_mainwindow(&WndProc,ghmenu,hInstance,class_name,"DB_UTIL");

	ShowWindow(ghmainframe,nCmdShow);
	UpdateWindow(ghmainframe);

	haccel=LoadAccelerators(ghinstance,MAKEINTRESOURCE(IDR_ACCELERATOR1));

	process_cmd_line(lpCmdLine);

    while(GetMessage(&msg,NULL,0,0)){
		if(!custom_dispatch(&msg))
		if(!TranslateMDISysAccel(ghmdiclient, &msg) && !TranslateAccelerator(ghmainframe,haccel,&msg)){
			TranslateMessage(&msg);
			//if(msg!=WM_MOUSEFIRST&&msg!=WM_NCHITTEST&&msg!=WM_SETCURSOR&&msg!=WM_ENTERIDLE&&msg!=WM_NOTIFY)
			if(FALSE)
			if(msg.message!=0x118&&msg.message!=WM_NCHITTEST&&msg.message!=WM_SETCURSOR&&msg.message!=WM_ENTERIDLE&&msg.message!=WM_NCMOUSEMOVE&&msg.message!=WM_MOUSEFIRST)
			{
				static DWORD tick=0;
				if((GetTickCount()-tick)>500)
					printf("--\n");
				printf("x");
				print_msg(msg.message,msg.lParam,msg.wParam,msg.hwnd);
				tick=GetTickCount();
			}
			DispatchMessage(&msg);
		}
    }
	DeleteCriticalSection(&mutex);
    return msg.wParam;
	
}