Example #1
0
int main(int argc, char **argv)
{
  Ihandle *dlg;
  Ihandle *config;

  IupOpen(&argc, &argv);
  IupGLCanvasOpen();
  IupImageLibOpen();

  config = IupConfig();
  IupSetAttribute(config, "APP_NAME", "simple_paint");
  IupConfigLoad(config);

  dlg = create_main_dialog(config);

  /* show the dialog at the last position, with the last size */
  IupConfigDialogShow(config, dlg, "MainWindow");

  /* open a file from the command line (allow file association in Windows) */
  if (argc > 1 && argv[1])
  {
    const char* filename = argv[1];
    open_file(dlg, filename);
  }

  /* initialize the current file, if not already loaded */
  check_new_file(dlg);

  IupMainLoop();

  IupClose();
  return EXIT_SUCCESS;
}
Example #2
0
bool GenSurfInit(){
	strcpy( gszVersion, "1.05" );
	strcpy( gszCaption, "GtkGenSurf" );
	if ( strlen( gszVersion ) ) {
		strcat( gszCaption, " v" );
		strcat( gszCaption, gszVersion );
	}

	strcpy( gszIni, g_FuncTable.m_pfnProfileGetDirectory() );
	strcat( gszIni, "gensurf.ini" );

/*if (g_FuncTable.m_pfnReadProjectKey != NULL)
   {
    char *basepath;

    basepath = g_FuncTable.m_pfnReadProjectKey("basepath");
    if (basepath)
    {
      strlwr (basepath);
      if (strstr(basepath,"baseq3"))
        Game = QUAKE3;
      else if (strstr (basepath,"baseq2"))
        Game = QUAKE2;
      else // Gotta have a game, might as well be Quake3
        Game = QUAKE3;
    }
    else
      Game = QUAKE3;
   }
   else */
	Game = QUAKE3;


	if ( g_pWnd == NULL ) {
		g_pWnd = create_main_dialog();
	}

	ReadIniFile( gszIni );

	return true;
}
Example #3
0
void on_login (int fd, struct message *msg)
{
	printf ("on_login\n");
	printf ("msg.type = %d\n", msg->type);
	printf ("msg.buff = %d\n", msg->buff[0]);
	if (msg->buff[0] == 0)
	{
		hide_login_dialog ();
		create_main_dialog ();
		show_main_dialog ();
		msg->type = GET_ROOM_INFO;
		send_message (msg);
		//play_sound ("sound/bg.mp3",0);
	}
	else if (msg->buff[0] == 1)
	{
		show_message_dialog (GTK_MESSAGE_ERROR, "密码错误!");
	}
	else
	{
		show_message_dialog (GTK_MESSAGE_ERROR, "用户不存在!");
	}
}
Example #4
0
static void
run (const gchar      *name,
     gint              nparams,
     const GimpParam  *param,
     gint             *nreturn_vals,
     GimpParam       **return_vals)
{
  static GimpParam   values[1];
  GimpDrawable      *drawable;
  GimpRunMode        run_mode;
  GimpPDBStatusType  status = GIMP_PDB_SUCCESS;

  run_mode = param[0].data.d_int32;

  INIT_I18N ();

  *nreturn_vals = 1;
  *return_vals  = values;

  values[0].type          = GIMP_PDB_STATUS;
  values[0].data.d_status = status;

  /* Set default values */
  /* ================== */

  set_default_settings ();

  /* Possibly retrieve data */
  /* ====================== */

  gimp_get_data (PLUG_IN_PROC, &licvals);

  /* Get the specified drawable */
  /* ========================== */

  drawable = gimp_drawable_get (param[2].data.d_drawable);

  if (status == GIMP_PDB_SUCCESS)
    {
      /* Make sure that the drawable is RGBA or RGB color */
      /* ================================================ */

      if (gimp_drawable_is_rgb (drawable->drawable_id))
        {
          /* Set the tile cache size */
          /* ======================= */

          gimp_tile_cache_ntiles (2*(drawable->width / gimp_tile_width () + 1));

          switch (run_mode)
            {
              case GIMP_RUN_INTERACTIVE:
                if (create_main_dialog ())
                  compute_image (drawable);

                gimp_set_data (PLUG_IN_PROC, &licvals, sizeof (LicValues));
              break;
              case GIMP_RUN_WITH_LAST_VALS:
                compute_image (drawable);
                break;
              default:
                break;
            }
        }
      else
        status = GIMP_PDB_EXECUTION_ERROR;
    }

  values[0].data.d_status = status;
  gimp_drawable_detach (drawable);
}