Пример #1
0
static void handle_file( LWControl *ectl, void *edata )
{
   char a[ 24 ];
   struct stat s;
   time_t timestamp;

   GET_STR( ectl, filename, sizeof( filename ));
   if ( filename[ 0 ] == 0 ) return;

   if ( fp ) fclose( fp );
   if ( !( fp = fopen( filename, "rb" ))) {
      msgf->error( "Couldn't open", filename );
      return;
   }

   stat( filename, &s );
   filesize = s.st_size;
   timestamp = s.st_mtime;

   pos = 0;
   set_scroll();

   SET_STR( ctl[ 11 ], itoa( filesize, a, 10 ), sizeof( a ));
   strftime( a, sizeof( a ), "%d %b %y %X", localtime( &timestamp ));
   SET_STR( ctl[ 2 ], a, strlen( a ));

   ctl[ 0 ]->draw( ctl[ 0 ], DR_REFRESH );
}
Пример #2
0
void driver_info_destroy(DriverInfo* thiz)
{
	if(thiz != NULL)
	{
		SET_STR(thiz->name, NULL);
		SET_STR(thiz->author, NULL);
		SET_STR(thiz->email, NULL);
		SET_STR(thiz->description, NULL);
		SET_STR(thiz->license, NULL);

		g_free(thiz);
	}
}
Пример #3
0
void gncEntrySetDescription (GncEntry *entry, const char *desc)
{
    if (!entry || !desc) return;
    SET_STR (entry, entry->desc, desc);
    mark_entry (entry);
    gncEntryCommitEdit (entry);
}
Пример #4
0
void gncEntrySetAction (GncEntry *entry, const char *action)
{
    if (!entry || !action) return;
    SET_STR (entry, entry->action, action);
    mark_entry (entry);
    gncEntryCommitEdit (entry);
}
Пример #5
0
void gncEntrySetNotes (GncEntry *entry, const char *notes)
{
    if (!entry || !notes) return;
    SET_STR (entry, entry->notes, notes);
    mark_entry (entry);
    gncEntryCommitEdit (entry);
}
Пример #6
0
void gncEmployeeSetLanguage (GncEmployee *employee, const char *language)
{
    if (!employee) return;
    if (!language) return;
    SET_STR(employee, employee->language, language);
    mark_employee (employee);
    gncEmployeeCommitEdit (employee);
}
Пример #7
0
void gncEmployeeSetUsername (GncEmployee *employee, const char *username)
{
    if (!employee) return;
    if (!username) return;
    SET_STR(employee, employee->username, username);
    mark_employee (employee);
    gncEmployeeCommitEdit (employee);
}
Пример #8
0
void gncEmployeeSetID (GncEmployee *employee, const char *id)
{
    if (!employee) return;
    if (!id) return;
    SET_STR(employee, employee->id, id);
    mark_employee (employee);
    gncEmployeeCommitEdit (employee);
}
Пример #9
0
void gncBillTermSetDescription (GncBillTerm *term, const char *desc)
{
    if (!term || !desc) return;
    SET_STR (term, term->desc, desc);
    mark_term (term);
    maybe_resort_list (term);
    gncBillTermCommitEdit (term);
}
Пример #10
0
void gncCustomerSetName (GncCustomer *cust, const char *name)
{
    if (!cust) return;
    if (!name) return;
    SET_STR(cust, cust->name, name);
    mark_customer (cust);
    gncCustomerCommitEdit (cust);
}
Пример #11
0
void gncAddressSetFax (GncAddress *addr, const char *fax)
{
    if (!addr) return;
    if (!fax) return;
    SET_STR(addr, addr->fax, fax);
    mark_address (addr);
    gncAddressCommitEdit (addr);
}
Пример #12
0
void gncAddressSetPhone (GncAddress *addr, const char *phone)
{
    if (!addr) return;
    if (!phone) return;
    SET_STR(addr, addr->phone, phone);
    mark_address (addr);
    gncAddressCommitEdit (addr);
}
Пример #13
0
void gncAddressSetAddr4 (GncAddress *addr, const char *addr4)
{
    if (!addr) return;
    if (!addr4) return;
    SET_STR(addr, addr->addr4, addr4);
    mark_address (addr);
    gncAddressCommitEdit (addr);
}
Пример #14
0
void gncAddressSetName (GncAddress *addr, const char *name)
{
    if (!addr) return;
    if (!name) return;
    SET_STR(addr, addr->name, name);
    mark_address (addr);
    gncAddressCommitEdit (addr);
}
Пример #15
0
void gncTaxTableSetName (GncTaxTable *table, const char *name)
{
    if (!table || !name) return;
    SET_STR (table, table->name, name);
    mark_table (table);
    maybe_resort_list (table);
    gncTaxTableCommitEdit (table);
}
Пример #16
0
void gncCustomerSetID (GncCustomer *cust, const char *id)
{
    if (!cust) return;
    if (!id) return;
    SET_STR(cust, cust->id, id);
    mark_customer (cust);
    gncCustomerCommitEdit (cust);
}
Пример #17
0
void gncAddressSetEmail (GncAddress *addr, const char *email)
{
    if (!addr) return;
    if (!email) return;
    SET_STR(addr, addr->email, email);
    mark_address (addr);
    gncAddressCommitEdit (addr);
}
Пример #18
0
void gncCustomerSetNotes (GncCustomer *cust, const char *notes)
{
    if (!cust) return;
    if (!notes) return;
    SET_STR(cust, cust->notes, notes);
    mark_customer (cust);
    gncCustomerCommitEdit (cust);
}
Пример #19
0
void gncBillTermSetName (GncBillTerm *term, const char *name)
{
    if (!term || !name) return;
    SET_STR (term, term->name, name);
    mark_term (term);
    maybe_resort_list (term);
    gncBillTermCommitEdit (term);
}
Пример #20
0
void gncEmployeeSetAcl (GncEmployee *employee, const char *acl)
{
    if (!employee) return;
    if (!acl) return;
    SET_STR(employee, employee->acl, acl);
    mark_employee (employee);
    gncEmployeeCommitEdit (employee);
}
Пример #21
0
void gncJobSetReference (GncJob *job, const char *desc)
{
    if (!job) return;
    if (!desc) return;
    SET_STR(job, job->desc, desc);
    mark_job (job);
    gncJobCommitEdit (job);
}
Пример #22
0
void gncJobSetName (GncJob *job, const char *name)
{
    if (!job) return;
    if (!name) return;
    SET_STR(job, job->name, name);
    mark_job (job);
    gncJobCommitEdit (job);
}
Пример #23
0
void gncJobSetID (GncJob *job, const char *id)
{
    if (!job) return;
    if (!id) return;
    SET_STR(job, job->id, id);
    mark_job (job);
    gncJobCommitEdit (job);
}
Пример #24
0
// MakeRegisterPanel():
//  Creates the Register Panel
bool SimplifyDongle::MakeRegisterPanel() {
  if( simp_int == NULL )
    return false;

  // Create the Panel
  register_panel = simp_int->panel_funcs->Create( "Simplify Registration" );

  try {
    if( !( dongle_id = STRRO_CTL( simp_int->panel_funcs->orig_struct, register_panel,
                                  "Dongle ID", 43 ) ) )
      throw false;

    if( !( reg_code = STR_CTL( simp_int->panel_funcs->orig_struct, register_panel,
                               "Reg Code", 43 ) ) )
      throw false;

    if( !( register_now = WBUTTON_CTL( simp_int->panel_funcs->orig_struct, register_panel,
                                       "Register Now", 150 ) ) )
      throw false;

    // Position some things
    MOVE_CON( dongle_id, 25, 212 );
    PanelTools::AlignLabels( dongle_id, reg_code );

    PAN_SETW( simp_int->panel_funcs->orig_struct, register_panel, 400 );
    PAN_SETH( simp_int->panel_funcs->orig_struct, register_panel, 350 );

    PanelTools::PutUnder( reg_code, register_now );

    int pw = PAN_GETW( simp_int->panel_funcs->orig_struct, register_panel );
    int w  = CON_W( register_now );
    int y  = CON_Y( register_now );
    MOVE_CON( register_now, (pw/2 - w/2), y );

    // Default Values
    char buffer[10];
    sprintf( buffer, "%ld", GetDongleID() );
    SET_STR( dongle_id, buffer, strlen( buffer ) );

    // Listener Functions
    CON_SETEVENT( register_now, OnRegisterNow, this );
    CON_SETEVENT( reg_code,     OnRegisterNow, this );

    // Set the Draw Functions
    simp_int->panel_funcs->Set( register_panel, PAN_USERDRAW, DrawRegisterPanel );

    return true;
  } catch( bool a ) {
    if( !a ) {
      simp_int->message->Error("Error creating interface controls; aborting" );
      return false;
    }
  }

  return true;
}
Пример #25
0
// OnItemMultiScroll():
//  Called to handle the custom scroll bar under the lister
void OnItemMultiScroll( LWControl *ctl, int mx, fk_mousestate mouse_state ) {
  static last_clicked = CLICKED_NONE;
  static down_pos     = 0;
  static item_pos     = 0;

  // Mouse Released; Reset
  if( mouse_state == MSTATE_UP ) {
    SET_STR( fk_int->select_item_name, "MS:  Mouse Released", strlen( "MS:  Mouse Released" ) );
    last_clicked = CLICKED_NONE;
    REDRAW_CON( fk_int->item_multiscroll );
    return;
  }

  // Mouse was just clicked; see what was clicked
  if( mouse_state == MSTATE_DOWN ) {
    down_pos = mx;
    mx -= CON_HOTX( ctl );

    // Test the Divider
    int div_near = mx > fk_int->ms_divider ? mx-fk_int->ms_divider: fk_int->ms_divider-mx;
    if( div_near < 6 ) {
      last_clicked = CLICKED_DIVIDER;
      item_pos = fk_int->ms_divider;

      SET_STR( fk_int->select_item_name, "MS:  Clicked Divider", strlen( "MS:  Clicked Divider" ) );
    }

    return;
  }

  // Mouse Moved:  Change some value
  if( mouse_state == MSTATE_MOVING ) {
    if( last_clicked == CLICKED_DIVIDER )
      fk_int->ms_divider = mx;
//      fk_int->ms_divider = down_pos - item_pos + mx - item_pos;

    char buffer[ 64 ];
    sprintf( buffer, "MS:  Moved Divider to %d", fk_int->ms_divider );
    SET_STR( fk_int->select_item_name, buffer, strlen( buffer ) );

    REDRAW_CON( ctl );
  }
}
Пример #26
0
// HandleList():
void HandleList( LWControl *con, void *data ) {
  int index, column, other;
  GET_IVEC( rint->list, index, column, other );

  if( index >= (int)rint->swaps.NumElements() ) {
    index = ((int)rint->swaps.NumElements()) - 1;
    SET_IVEC( rint->list, index, 1, 0 );
  } else {
    if( index != -1 ) {
      int x = CON_MOUSEX( con );
      int y = CON_MOUSEY( con );

      if( x < list_column_widths[0] + 8 )
        rint->swaps[ index ]->SetUse( !rint->swaps[ index ]->GetUse() );
    }
  }

  if( index == -1 ) {
    SET_STR( rint->path, "", 0 );
    SET_FLOAT( rint->weight, 1.0 );
    SET_INT( rint->enable, 1 );

    GHOST_CON( rint->path   );
    GHOST_CON( rint->weight );
    GHOST_CON( rint->enable );
  } else {
    char * string = (char *)rint->swaps[ index ]->GetFullPath();
    if( string == NULL ) {
      SET_STR( rint->path, "", 0 );
    } else {
      SET_STR( rint->path, string, strlen( string ) );
    }

    SET_FLOAT( rint->weight, rint->swaps[ index ]->GetWeight() );
    SET_INT( rint->enable,   rint->swaps[ index ]->GetUse() );

    UNGHOST_CON( rint->path   );
    UNGHOST_CON( rint->weight );
    UNGHOST_CON( rint->enable );
  }
}
Пример #27
0
static void saver_event( LWControl *sctl, LWControl *ectl )
{
   LWValue
      ival = { LWT_INTEGER },
      sval = { LWT_STRING };
   char filename[ 260 ];
   int saver;

   GET_INT( sctl, saver );
   GET_STR( ectl, filename, sizeof( filename ));
   filename_ext( saver, filename );
   SET_STR( ectl, filename, sizeof( filename ));
   RENDER_CON( ectl );
}
Пример #28
0
static void drawcb_text( LWControl *ectl, void *edata, DrMode mode )
{
   static int size[] = { 1, 2, 4, 4, 8, 2, 4 };
   char a[ 10 ];
   int rlen;

   if ( !fp ) return;
   fseek( fp, pos, SEEK_SET );
   rlen = fread( buf, 1, pagesize, fp );

   SET_STR( ctl[ 9 ], itoa( pos % size[ datatype ], a, 10 ), sizeof( a ));

   show_byt( pos, rlen, linesize );
   show_prt( buf, rlen, linesize );
   show_num( buf, rlen, datatype, unsign, byteorder != natorder, linesize );
}
Пример #29
0
static void ctl_set( void )
{
   int i;

   SET_STR( ctl[ 0 ], sequence, strlen( sequence ));
   SET_INT( ctl[ 1 ], atom_type );
   SET_INT( ctl[ 2 ], atom_nsides );
   SET_INT( ctl[ 3 ], atom_nsegments );
   for ( i = 0; i < 5; i++ )
      SET_FLOAT( ctl[ i + 5 ], atom_radius[ i ] );
   SET_INT( ctl[ 10 ], bond_type );
   SET_INT( ctl[ 11 ], bond_nsides );
   SET_INT( ctl[ 12 ], bond_nsegments );
   SET_FLOAT( ctl[ 13 ], bond_radius );
   SET_INT( ctl[ 14 ], do_plates );
}
Пример #30
0
/*
 *  UI_UtilString1        QUERY ONE STRING
 */
int UI_UtilString1( LWPanelFuncs *panfunc, char *title, char *caption, char *strin, char *strout )
{
	LWPanelID			panelID;
	LWControl           *control;
	int                 btn;

	panelID = (*panfunc->create)( title, NULL );
	control = STR_CTL( panfunc, panelID, caption, 40 );
	SET_STR( control, strin, 255 );
	btn     = (*panfunc->open)( panelID, PANF_BLOCKING|PANF_CANCEL );
	if (btn) {
		GET_STR( control, strout, 255 );
	}
	PAN_KILL( panfunc, panelID );

	return btn;
}