Ejemplo n.º 1
0
Archivo: setup.c Proyecto: dmtrkun/Andr
uchar setup(void)
{
	lcd_clear();
	
	setup_menu();
	return 0;
}
Ejemplo n.º 2
0
void
enter_file_info_mode(FileView *v)
{
	vle_mode_set(FILE_INFO_MODE, VMT_PRIMARY);
	view = v;
	setup_menu();
	redraw_file_info_dialog();

	was_redraw = 0;
}
Ejemplo n.º 3
0
void
enter_file_info_mode(FileView *v)
{
	*mode = FILE_INFO_MODE;
	view = v;
	setup_menu();
	redraw_file_info_dialog();

	was_redraw = 0;
}
Ejemplo n.º 4
0
int start_menu_mode(struct s_hardware *hardware, char *version_string)
{
    struct s_hdt_menu hdt_menu;

    memset(&hdt_menu, 0, sizeof(hdt_menu));

    /* Setup the menu system */
    setup_menu(version_string);

    /* Compute all submenus */
    compute_submenus(&hdt_menu, hardware);

    /* Compute the main menu */
    compute_main_menu(&hdt_menu, hardware);

#ifdef WITH_MENU_DISPLAY
    t_menuitem *curr;
    char cmd[160];

    if (!quiet)
	more_printf("Starting Menu (%d menus)\n", hdt_menu.total_menu_count);
    curr = showmenus(hdt_menu.main_menu.menu);
    /* When we exit the menu, do we have something to do? */
    if (curr) {
	/* When want to execute something */
	if (curr->action == OPT_RUN) {
	    /* Tweak, we want to switch to the cli */
	    if (!strncmp
		(curr->data, HDT_SWITCH_TO_CLI, sizeof(HDT_SWITCH_TO_CLI))) {
		return HDT_RETURN_TO_CLI;
	    }
	    /* Tweak, we want to start the dump mode */
	    if (!strncmp
		(curr->data, HDT_DUMP, sizeof(HDT_DUMP))) {
		    dump(hardware);
	        return 0;
	    }
	    if (!strncmp
		(curr->data, HDT_REBOOT, sizeof(HDT_REBOOT))) {
		syslinux_reboot(1);
	    }
	    strcpy(cmd, curr->data);

	    /* Use specific syslinux call if needed */
	    if (issyslinux())
		runsyslinuxcmd(cmd);
	    else
		csprint(cmd, 0x07);
	    return 1;		// Should not happen when run from SYSLINUX
	}
    }
#endif
    return 0;
}
Ejemplo n.º 5
0
int main(int argc, char** argv) {
  glutInit(&argc, argv);
  setup_app();
  setup_menu();
  setup_scene();

  pi_setup();

  glutTimerFunc(0, render_loop, 0);
  glutTimerFunc(0, logic_loop, 0);
  glutTimerFunc(0, ai_loop, 0);
  glutMainLoop();
   return 0;
}
Ejemplo n.º 6
0
void
enter_file_info_mode(FileView *v)
{
	if(fentry_is_fake(get_current_entry(v)))
	{
		show_error_msg("File info", "Entry doesn't correspond to a file.");
		return;
	}

	vle_mode_set(FILE_INFO_MODE, VMT_PRIMARY);
	view = v;
	setup_menu();
	redraw_file_info_dialog();

	was_redraw = 0;
}
Ejemplo n.º 7
0
int
display_menu(menu_state_t *m, FileView *view)
{
	if(m->d->len < 1)
	{
		status_bar_message(m->d->empty_msg);
		reset_menu_data(m->d);
		return 1;
	}

	init_menu_state(m, view);

	setup_menu();
	draw_menu(m);
	move_to_menu_pos(m->d->pos, m);
	enter_menu_mode(m->d, view);
	return 0;
}
Ejemplo n.º 8
0
Archivo: menus.c Proyecto: lyuts/vifm
int
display_menu(menu_info *m, FileView *view)
{
	if(m->len < 1)
	{
		status_bar_message(m->empty_msg);
		reset_popup_menu(m);
		return 1;
	}
	else
	{
		setup_menu();
		draw_menu(m);
		move_to_menu_pos(m->pos, m);
		enter_menu_mode(m, view);
		return 0;
	}
}
Ejemplo n.º 9
0
static void
gp_menu_button_applet_setup (GpMenuButtonApplet *menu_button)
{
  GpMenuButtonAppletPrivate *priv;

  priv = gp_menu_button_applet_get_instance_private (menu_button);

  priv->settings = gp_applet_settings_new (GP_APPLET (menu_button),
                                           MENU_BUTTON_SCHEMA);

  g_signal_connect (priv->settings, "changed",
                    G_CALLBACK (settings_changed_cb), menu_button);

  g_signal_connect (menu_button, "notify::panel-icon-size",
                    G_CALLBACK (panel_icon_size_cb), menu_button);

  setup_menu (menu_button);
  setup_button (menu_button);
}
Ejemplo n.º 10
0
main(int argc, char *argv[])
{
   int n;
   int rows, cols;
   int drawButtons;
   char *btn_font, *disp_font;
   /* GtkWidget *main_w; */
   GtkWidget *vbox;
   GtkWidget *menu;
   GtkWidget *mdisp;
   GtkWidget *lcd;
   GtkWidget *btns;
   GdkFont *new_font;
   GtkStyle *default_style, *new_style;
   GdkBitmap *icon_bitmap;
#ifdef USE_GNOME
   GnomeAppBar *appbar;
#endif

   setlocale(LC_ALL, "C");
#ifdef USE_GNOME
   gnome_init("grpn", "1.0", argc, argv);
   gnome_app_new("grpn", "grpn");
#else
   /* initialize gtk */
   gtk_init(&argc, &argv);
#endif

   /* initial values */
   drawButtons = 1;
   rows = 8;
   cols = 30;
   btn_font = disp_font = NULL;

   /* process command line args */
   n = 1;
   while(n < argc){
      if(0 == strcmp("-fn", argv[n])){
         n++;
         if(n >= argc){
            usage("Missing required argument for -fn.");
            exit(0);
         }
         btn_font = disp_font = argv[n];
      } else if(0 == strcmp("-btn-fn", argv[n])){
         n++;
         if(n >= argc){
            usage("Missing required argument for -btn-fn.");
            exit(0);
         }
         btn_font = argv[n];
      } else if(0 == strcmp("-disp-fn", argv[n])){
         n++;
         if(n >= argc){
            usage("Missing required argument for -disp-fn.");
            exit(0);
         }
         disp_font = argv[n];
      } else if(0 == strcmp("-rows", argv[n])){
         n++;
         if(n >= argc){
            usage("Missing required argument for -rows.");
            exit(0);
         }
         if(1 != sscanf(argv[n], "%d", &rows)){
            usage("Unable to read number or rows.");
            exit(0);
         }
      } else if(0 == strcmp("-cols", argv[n])){
         n++;
         if(n >= argc){
            usage("Missing required argument for -cols.");
            exit(0);
         }
         if(1 != sscanf(argv[n], "%d", &cols)){
            usage("Unable to read number or cols.");
            exit(0);
         }
      } else if(0 == strcmp("-b", argv[n])){
         drawButtons = 0;
      } else if(0 == strcmp("-bm", argv[n])){
         n++;
         if(n >= argc){
            usage("Missing required argument for -m.");
            exit(0);
         }
         if (0 == strcmp("dec", argv[n])){
             setBaseMode(DECIMAL);
	 } else if (0 == strcmp("eng", argv[n])){
             setBaseMode(DECIMAL_ENG);
	 } else if (0 == strcmp("bin", argv[n])){
             setBaseMode(BINARY);
	 } else if (0 == strcmp("oct", argv[n])){
             setBaseMode(OCTAL);
	 } else if (0 == strcmp("hex", argv[n])){
             setBaseMode(HEXADECIMAL);
	 } else {
             usage("Specify dec, eng, bin, oct or hex for -m.");
             exit(0);
         }
      } else {
         usage("Unknown Argument.");
         exit(0);
      }
      n++;
   }

   /* set up any constants we may use */
   setup_constant();

   /* initialize the undo system */
   initUndoSystem();

   /* setup the stack */
   if(0 == setup_stack()){
      fprintf(stderr, "Error: Could not initalize data structures.\n");
      exit(0);
   }

   /* set the font if told */
   if(btn_font != NULL){
      default_style = gtk_widget_get_default_style();
      if(NULL == (new_font = gdk_font_load(btn_font))){
         fprintf(stderr, "Unable to load font %s.\n", btn_font);
         exit(0);
      }
      new_style = gtk_style_copy(default_style);
      new_style->font_desc = new_font;
/* BDD - No longer in Gtk2.x */
/*      gtk_widget_set_default_style(new_style); */
   }
   

#ifdef USE_GNOME
   main_w = gnome_app_new("grpn", "grpn");
   setup_menu(main_w);

   appbar = GNOME_APPBAR(gnome_appbar_new(FALSE, FALSE, FALSE));
   gnome_app_set_statusbar(GNOME_APP(main_w), GTK_WIDGET(appbar));

   /*create the box that everyone goes in */
   vbox = gtk_vbox_new(FALSE, 0);
   gnome_app_set_contents(GNOME_APP(main_w), vbox);
   gtk_widget_show(vbox);

#else
   /* the main window contains the work area and the menubar */
   main_w = gtk_window_new(GTK_WINDOW_TOPLEVEL);
   gtk_widget_set_name(main_w, "grpn");

   /*create the box that everyone goes in */
   vbox = gtk_vbox_new(FALSE, 0);
   gtk_container_add(GTK_CONTAINER(main_w), vbox);
   gtk_widget_show(vbox);

   /* set up the menu bar */
   menu = setup_menu(vbox);
#endif

   /* handle window manager close */
   gtk_signal_connect(GTK_OBJECT(main_w), "delete_event",
      GTK_SIGNAL_FUNC(delete_event), NULL);
   gtk_signal_connect(GTK_OBJECT(main_w), "destroy",
      GTK_SIGNAL_FUNC(destroy), NULL);

   /* create the varrious subsystems */
   mdisp = setupModeDisplay(vbox);
   if(drawButtons) btns = setupButtons(vbox);
   lcd = setupLCD(vbox, rows, cols, disp_font);

   /* Create pixmap of depth 1 (bitmap) for icon */
   gtk_widget_realize(main_w);
   icon_bitmap = gdk_bitmap_create_from_data(main_w->window,
      icon_bitmap_bits, icon_bitmap_width, icon_bitmap_height);
   gdk_window_set_icon(main_w->window, NULL, icon_bitmap, NULL);

   gtk_widget_show(main_w);

   gtk_main();

}
Ejemplo n.º 11
0
EditorContextMenu::EditorContextMenu(QWidget *parent) : QMenu(parent)
{
 setup_actions();
 setup_signals();
 setup_menu();
}
Ejemplo n.º 12
0
main_window::main_window(QWidget *parent): QMainWindow(parent)
{
    QSplitter *main_splitter = new QSplitter(this);
    setCentralWidget(main_splitter);

    m_objects_tree = new objects_tree(this);
    m_objects_tree->setHeaderLabel("Objects selection");
    m_objects_tree->setSelectionMode(QAbstractItemView::ExtendedSelection);
    m_objects_tree->setDragDropMode(QAbstractItemView::InternalMove);
    m_objects_tree->invisibleRootItem()->setFlags(0);
    connect(m_objects_tree, SIGNAL(itemSelectionChanged()), this, SLOT(on_obj_selected()));
    connect(m_objects_tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(on_obj_focus(QTreeWidgetItem*, int)));

    main_splitter->addWidget(m_objects_tree);

    m_scene_view = new scene_view(this);
    m_scene_view->update_objects_tree = std::bind(&main_window::update_objects_tree, this);
    m_scene_view->set_selection = std::bind(&main_window::set_selection, this, std::placeholders::_1, std::placeholders::_2);
    main_splitter->addWidget(m_scene_view);

    m_navigator = new QTabWidget;
    main_splitter->addWidget(m_navigator);

    main_splitter->setSizes(QList<int>() << 200 << 1000 << 450);

    auto add_objects_tree = new QTreeWidget;
    add_objects_tree->setHeaderLabel("Objects");
    m_navigator->insertTab(mode_add, add_objects_tree, "Add");
    auto &obj_list = game::get_objects_list();
    for (auto &o: obj_list)
    {
        auto item = new_tree_item(o.id);
        if (o.group.empty())
        {
            add_objects_tree->addTopLevelItem(item);
            continue;
        }

        QList<QTreeWidgetItem*> items = add_objects_tree->findItems(o.group.c_str(), Qt::MatchExactly, 0);
        if (!items.empty())
        {
            items[0]->addChild(item);
            continue;
        }

        auto group = new_tree_group(o.group);
        add_objects_tree->addTopLevelItem(group);
        group->addChild(item);
    }
    connect(add_objects_tree, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(on_add_tree_selected(QTreeWidgetItem*, int)));

    m_edit = new QStackedWidget;
    m_navigator->insertTab(mode_edit, m_edit, "Edit");

    auto edit_none = new QLabel;
    edit_none->setText("\nNo editable object selected");
    edit_none->setAlignment(Qt::AlignTop);
    m_edit->addWidget(edit_none);
    auto edit_multiple = new QLabel;
    edit_multiple->setText("\nMultiple objects selected");
    edit_multiple->setAlignment(Qt::AlignTop);
    m_edit->addWidget(edit_multiple);

    auto edit_obj_l = new QFormLayout;
    m_edit_obj_name = new QLineEdit;
    connect(m_edit_obj_name, SIGNAL(textChanged(const QString &)), this, SLOT(on_name_changed(const QString &)));
    edit_obj_l->addRow("Name:", m_edit_obj_name);

    m_edit_obj_follow = new QLineEdit;
    connect(m_edit_obj_follow, SIGNAL(textChanged(const QString &)), this, SLOT(on_obj_follow_changed(const QString &)));
    edit_obj_l->addRow("Follow:", m_edit_obj_follow);

    m_edit_obj_target = new QLineEdit;
    connect(m_edit_obj_target, SIGNAL(textChanged(const QString &)), this, SLOT(on_obj_target_changed(const QString &)));
    edit_obj_l->addRow("Target:", m_edit_obj_target);

    m_edit_obj_path = new QLineEdit;
    connect(m_edit_obj_path, SIGNAL(textChanged(const QString &)), this, SLOT(on_obj_path_changed(const QString &)));
    edit_obj_l->addRow("Path:", m_edit_obj_path);

    m_edit_obj_active = new QCheckBox;
    connect(m_edit_obj_active, SIGNAL(stateChanged(int)), this, SLOT(on_active_changed(int)));
    edit_obj_l->addRow("Active:", m_edit_obj_active);

    m_edit_obj_align = new QComboBox();
    const char *align_id[] = {"target", "enemy", "ally", "neutral"};
    for (auto a: align_id)
        m_edit_obj_align->addItem(a);
    QObject::connect(m_edit_obj_align, SIGNAL(activated(int)), this, SLOT(on_align_changed(int)));
    edit_obj_l->addRow("Align:", m_edit_obj_align);
    edit_obj_l->addRow("On init:", m_edit_obj_init = new function_edit(this, "on_init"));
    edit_obj_l->addRow("On destroy:", m_edit_obj_destroy = new function_edit(this, "on_destroy"));
    auto edit_obj_w = new QWidget;
    edit_obj_w->setLayout(edit_obj_l);
    m_edit->addWidget(edit_obj_w);

    auto edit_path_l = new QFormLayout;
    m_edit_path_name = new QLineEdit;
    connect(m_edit_path_name, SIGNAL(textChanged(const QString &)), this, SLOT(on_name_changed(const QString &)));
    edit_path_l->addRow("Name:", m_edit_path_name);
    m_edit_path_loop = new QCheckBox;
    connect(m_edit_path_loop, SIGNAL(stateChanged(int)), this, SLOT(on_path_loop_changed(int)));
    edit_path_l->addRow("Loop:", m_edit_path_loop);
    auto edit_path_w = new QWidget;
    edit_path_w->setLayout(edit_path_l);
    m_edit->addWidget(edit_path_w);

    auto edit_zone_l = new QFormLayout;
    m_edit_zone_name = new QLineEdit;
    connect(m_edit_zone_name, SIGNAL(textChanged(const QString &)), this, SLOT(on_name_changed(const QString &)));
    edit_zone_l->addRow("Name:", m_edit_zone_name);
    m_edit_zone_active = new QCheckBox;
    connect(m_edit_zone_active, SIGNAL(stateChanged(int)), this, SLOT(on_active_changed(int)));
    edit_zone_l->addRow("Active:", m_edit_zone_active);
    edit_zone_l->addRow("On enter:", m_edit_zone_enter = new function_edit(this, "on_enter"));
    edit_zone_l->addRow("On leave:", m_edit_zone_leave = new function_edit(this, "on_leave"));
    m_edit_zone_display = new QComboBox();
    const char *display_id[] = {"none", "point", "circle", "cylinder"};
    for (auto a: display_id)
        m_edit_zone_display->addItem(a);
    QObject::connect(m_edit_zone_display, SIGNAL(activated(int)), this, SLOT(on_zone_display_changed(int)));
    edit_zone_l->addRow("Display:", m_edit_zone_display);
    auto edit_zone_w = new QWidget;
    edit_zone_w->setLayout(edit_zone_l);
    m_edit->addWidget(edit_zone_w);

    QWidget *path_widget = new QWidget;
    m_navigator->insertTab(mode_path, path_widget, "Path");

    QWidget *zone_widget = new QWidget;
    m_navigator->insertTab(mode_zone, zone_widget, "Zone");

    auto *script_layout = new QSplitter(Qt::Vertical);
    m_script_edit = new QTextEdit;
    connect(m_script_edit, SIGNAL(textChanged()), this, SLOT(on_script_changed()));
    new highlight_lua(m_script_edit->document());
    script_layout->addWidget(m_script_edit);
    m_script_errors = new QTextEdit;
    m_script_errors->setReadOnly(true);
    m_script_errors->setTextColor(Qt::red);
    script_layout->addWidget(m_script_errors);
    m_compile_timer = new QTimer(this);
    connect(m_compile_timer, SIGNAL(timeout()), this, SLOT(on_compile_script()));
    script_layout->setSizes(QList<int>() << 1000 << 100);
    m_navigator->insertTab(mode_script, script_layout, "Script");

    auto info_layout = new QFormLayout;
    QWidget *info_widget = new QWidget;
    m_navigator->insertTab(mode_info, info_widget, "Info");
    info_widget->setLayout(info_layout);
    info_layout->addRow("Title:", m_mission_title = new QLineEdit);
    info_layout->addRow("Author:", m_mission_author = new QLineEdit);
    info_layout->addRow("Email:", m_mission_email = new QLineEdit);
    info_layout->addRow("Desc:", m_mission_description = new QTextEdit);

    QSignalMapper *m = new QSignalMapper(this);
    for (int i = 0; i < modes_count; ++i)
    {
        QShortcut *s = new QShortcut(QKeySequence(("Ctrl+" + std::to_string(i+1)).c_str()), this);
        connect(s, SIGNAL(activated()), m, SLOT(map()));
        m->setMapping(s, i);
    }
    connect(m, SIGNAL(mapped(int)), m_navigator, SLOT(setCurrentIndex(int)));
    connect(m_navigator, SIGNAL(currentChanged(int)), this, SLOT(on_mode_changed(int)));

    m_scene_view->set_mode(scene_view::mode_other);
    setup_menu();
}
Ejemplo n.º 13
0
int main(int argc, char *argv[])
{
  int no_error=1;       /* Flag set to 0 on error */
  int usefile=0;        /* Flag set to 1 to use input setup file */
  int ncat1,ncat2;      /* Number of catalog objects */
  int nshift=0;         /* Number of matching objects */
  int another_loop=1;   /* Flag set to 0 when ending a loop */
  char fitsfile1[MAXC]; /* The name of the 1st FITS file to load */
  char catfile1[MAXC];  /* The name of the 1st SExtractor catalog file */
  char fitsfile2[MAXC]; /* The name of the 2nd FITS file to load */
  char catfile2[MAXC];  /* The name of the 2nd SExtractor catalog file */
  char setupfile[MAXC]; /* Name of the optional setup file */
  char line[MAXC];      /* General string to read input */
  Pos initshift;        /* Initial shift between two images */
  Pos shiftmean;        /* Mean shift */
  Pos shiftrms;         /* RMS on shift */
  Pos shiftmed;         /* Median shift */
  Image *image1;        /* The container of the 1st FITS image array */
  Image *image2;        /* The container of the 2nd FITS image array */
  Setup *setup1;        /* Container for the 1st image display info */
  Setup *setup2;        /* Container for the 2nd image display info */
  Secat *catdat1=NULL;  /* SExtractor data for 1st catalog */
  Secat *catdat2=NULL;  /* SExtractor data for 2nd catalog */
  Secat *shiftcat=NULL; /* Catalog of shifts between 1st and 2nd catalogs */

  /*
   * Check the command line
   */

  if(argc < 5) {
    fprintf(stderr,"\nfind_dither fitsfile1 catfile1 fitsfile2 catfile2 ");
    fprintf(stderr,"(setupfile)\n\n");
    return 1;
  }

  /*
   * Get the names of the files.
   */

  strcpy(fitsfile1,argv[1]);
  strcpy(catfile1,argv[2]);
  strcpy(fitsfile2,argv[3]);
  strcpy(catfile2,argv[4]);
  if(argc == 6) {
    usefile = 1;
    strcpy(setupfile,argv[5]);
  }
  else
    sprintf(setupfile,"");

  /*
   * Read the 1st data array.
   */

  if(!(image1 = new_Image(fitsfile1))) {
    fprintf(stderr,"ERROR.  Exiting program. Could not open %s\n\n",
	    fitsfile1);
    return 1;
  }

  if(load_image_data(image1) == ERROR)
    no_error = 0;

  /*
   * Create setup structure and fill with information used to set plotting
   *  parameters.
   */

  if(no_error) 
    if(!(setup1 = fill_setup(image1,setupfile,usefile,PIXEL)))
      no_error = 0;

  /*
   * Loop over displaying image until happy with results
   */

  if(no_error) {
    open_plot_window();
    if(display_image(image1,setup1))
      no_error = 0;
    else
      while(no_error && another_loop) {
	switch(another_loop = setup_menu(image1,setup1)) {
	case 1:
	  if(display_image(image1,setup1))
	    no_error = 0;
	  break;
	case 0:
	  break;
	case -1:
	  no_error = 0;
	  break;
	default:
	  break;
	}
      }
  }

  another_loop = 1;

  /*
   * Read the 2nd data array.
   */

  if(!(image2 = new_Image(fitsfile2))) {
    fprintf(stderr,"ERROR.  Exiting program. Could not open %s\n\n",
	    fitsfile1);
    return 1;
  }

  if(load_image_data(image2) == ERROR)
    no_error = 0;

  /*
   * Create setup structure and fill with information used to set plotting
   *  parameters.
   */

  if(no_error)
    if(!(setup2 = fill_setup(image2,setupfile,usefile,PIXEL)))
      no_error = 0;

  /*
   * Loop over displaying image until happy with results
   */

  if(no_error) {
    open_plot_window();
    if(display_image(image2,setup2))
      no_error = 0;
    else
      while(no_error && another_loop) {
	switch(another_loop = setup_menu(image2,setup2)) {
	case 1:
	  if(display_image(image2,setup2))
	    no_error = 0;
	  break;
	case 0:
	  break;
	case -1:
	  no_error = 0;
	  break;
	default:
	  break;
	}
      }
  }

  another_loop = 1;

  /*
   * Read in the first SExtractor catalog file
   */

  printf("---------------------------------------------------------------\n");
  if(no_error)
    if(!(catdat1 = read_secat(catfile1,'#',&ncat1,6)))
      no_error = 0;

  /*
   * Plot the catalog
   */

  if(no_error) {
    cpgslct(1);
    printf("\nPlotting SExtractor positions for first catalog\n");
    if(plot_secat(setup1,catdat1,ncat1,2,3,2.0))
      no_error = 0;
  }

  /*
   * Read in second SExtractor catalog file
   */

  if(no_error)
    if(!(catdat2 = read_secat(catfile2,'#',&ncat2,6)))
      no_error = 0;

  /*
   * Plot the catalog
   */

  if(no_error) {
    cpgslct(2);
    printf("\nPlotting SExtractor positions for second catalog\n");
    if(plot_secat(setup2,catdat2,ncat2,2,3,2.0))
      no_error = 0;
  }

  /*
   * Get initial shift
   */

  if(no_error) {
    get_init_shift(catdat1,ncat1,catdat2,ncat2,&initshift);
  }

  /*
   * Calculate shifts between first and second catalogs
   */

  if(no_error)
    if(!(shiftcat = find_shifts(catdat1,ncat1,catdat2,ncat2,initshift,
				setup2,&nshift,0)))
      no_error = 0;
    else
      printf("\nCalculated shifts between %d pairs.\n",nshift);

  /*
   * Get statistics on the shifts and plot results
   */

  if(no_error)
    plot_shifts(shiftcat,nshift);

  /*
   * Clean up and exit
   */

  cpgend();
  cpgend();
  image1 = del_Image(image1);
  setup1 = del_setup(setup1);
  catdat1 = del_secat(catdat1);
  image2 = del_Image(image2);
  setup2 = del_setup(setup2);
  catdat2 = del_secat(catdat2);
  shiftcat = del_secat(shiftcat);
  
  if(no_error) {
    printf("\nProgram find_dither.c completed.\n\n");
    return 0;
  }
  else {
    fprintf(stderr,"\nERROR. Exiting find_dither.c\n\n");
    return 1;
  }
}
Ejemplo n.º 14
0
void
show_full_file_properties(FileView *view)
{
	char name_buf[PATH_MAX];
//	char perm_buf[26];
	char size_buf[56];
//	char uid_buf[26];
	char buf[256];
	//struct passwd *pwd_buf;
  	//struct group *grp_buf;
	struct tm *tm_ptr;
	int x, y;
	int key = 0;
	int done = 0;


	curr_stats.show_full = 0;

	setup_menu(view);

	getmaxyx(menu_win, y, x);
	werase(menu_win);

	snprintf(name_buf, sizeof(name_buf), "%s", 
			view->dir_entry[view->list_pos].name);

	describe_file_size(size_buf, sizeof(size_buf), view);
	

	mvwaddstr(menu_win, 2, 2, "File: ");
	mvwaddnstr(menu_win, 2, 8, name_buf, x - 8);
	mvwaddstr(menu_win, 4, 2, "Size: ");
	mvwaddstr(menu_win, 4, 8, size_buf);

/*
	mvwaddstr(menu_win, 6, 2, "Type: ");
	if(S_ISLNK(view->dir_entry[view->list_pos].mode))
	{
		char linkto[PATH_MAX +NAME_MAX];
		int len;
		char *filename = strdup(view->dir_entry[view->list_pos].name);
		len = strlen(filename);
		if (filename[len - 1] == '/')
			filename[len - 1] = '\0';

	  	mvwaddstr(menu_win, 6, 8, "Link");
		len = readlink (filename, linkto, sizeof (linkto));

		mvwaddstr(menu_win, 7, 2, "Link To: ");
		if (len > 0)
		{
			linkto[len] = '\0';
			mvwaddnstr(menu_win, 7, 11, linkto, x - 11);
		}
	  	else
			mvwaddstr(menu_win, 7, 11, "Couldn't Resolve Link");
	}
 	else if (S_ISREG (view->dir_entry[view->list_pos].mode))
   	{
		FILE *pipe;
		char command[1024];
		char buf[NAME_MAX];
*/

		/* Use the file command to get file information */
/*
		snprintf(command, sizeof(command), "file \"%s\" -b", 
				view->dir_entry[view->list_pos].name);

		if ((pipe = popen(command, "r")) == NULL)
		{
			mvwaddstr(menu_win, 6, 8, "Unable to open pipe to read file");
			return;
		}

		fgets(buf, sizeof(buf), pipe);

		pclose(pipe);

		mvwaddnstr(menu_win, 6, 8, buf, x - 9);
*/
		/*
		if((S_IXUSR &view->dir_entry[view->list_pos].mode)
				|| (S_IXGRP &view->dir_entry[view->list_pos].mode)
				|| (S_IXOTH &view->dir_entry[view->list_pos].mode))

			mvwaddstr(other_view->win, 6, 8, "Executable");
		else
			mvwaddstr(other_view->win, 6, 8, "Regular File");
	}
	if (S_ISDIR (view->dir_entry[view->list_pos].mode))
	{
	  mvwaddstr(menu_win, 6, 8, "Directory");
	}
	else if (S_ISCHR (view->dir_entry[view->list_pos].mode))
	{
	  mvwaddstr(menu_win, 6, 8, "Character Device");
	}
	else if (S_ISBLK (view->dir_entry[view->list_pos].mode))
	{
	  mvwaddstr(menu_win, 6, 8, "Block Device");
	}
	else if (S_ISFIFO (view->dir_entry[view->list_pos].mode))
	{
	  mvwaddstr(menu_win, 6, 8, "Fifo Pipe");
	}
    else if (S_ISSOCK (view->dir_entry[view->list_pos].mode))
    {
	  mvwaddstr(menu_win, 6, 8, "Socket");
    }
  	else
    {
	  mvwaddstr(menu_win, 6, 8, "Unknown");
    }
*/

//	mvwaddstr(menu_win, 8, 2, "Permissions: ");
//	mvwaddstr(menu_win, 8, 15, perm_buf);
	mvwaddstr(menu_win, 10, 2, "Modified: ");
	tm_ptr = localtime(&view->dir_entry[view->list_pos].mtime);
  	strftime (buf, sizeof (buf), "%a %b %d %I:%M %p", tm_ptr);
	mvwaddstr(menu_win, 10, 13, buf);
	mvwaddstr(menu_win, 12, 2, "Accessed: ");
	tm_ptr = localtime(&view->dir_entry[view->list_pos].atime);
  	strftime (buf, sizeof (buf), "%a %b %d %I:%M %p", tm_ptr);
	mvwaddstr(menu_win, 12, 13, buf);
	mvwaddstr(menu_win, 14, 2, "Changed: ");
	tm_ptr = localtime(&view->dir_entry[view->list_pos].ctime);
  	strftime (buf, sizeof (buf), "%a %b %d %I:%M %p", tm_ptr);
	mvwaddstr(menu_win, 14, 13, buf);
	//mvwaddstr(menu_win, 16, 2, "Owner: ");
	//mvwaddstr(menu_win, 16, 10, uid_buf);
	//mvwaddstr(menu_win, 18, 2, "Group: ");
/*
	if((grp_buf = getgrgid(view->dir_entry[view->list_pos].gid)) != NULL)
	{
		mvwaddstr(menu_win, 18, 10, grp_buf->gr_name);
	}
*/
	wnoutrefresh(menu_win);

	box(menu_win, 0, 0);
	wrefresh(menu_win);
	while(!done)
	{
		key = wgetch(menu_win);
	
		/* ascii Return - Ctrl-c  - Escape */
		if(key == 13 || key == 3 || key == 27)
			done = 1;
	}
	werase(menu_win);
	curr_stats.menu = 0;
	redraw_window();
}