git-svn-id: svn://10.65.10.50/branches/R_10_00@23195 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
d85676355c
commit
1a83d268cb
@ -10,7 +10,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __CONFIG_H
|
#ifndef __CONFIG_H
|
||||||
class TConfig;
|
#include <config.h>;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class TCond_vendita : public TObject
|
class TCond_vendita : public TObject
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __VISWIN_H
|
#ifndef __VISWIN_H
|
||||||
class TViswin;
|
class TViswin;
|
||||||
#endif
|
#endif
|
||||||
@ -692,7 +696,7 @@ public:
|
|||||||
real& sconto_imp () { return _sconto_imp; }
|
real& sconto_imp () { return _sconto_imp; }
|
||||||
const real& sconto_imp () const { return _sconto_imp; }
|
const real& sconto_imp () const { return _sconto_imp; }
|
||||||
const TCodiceIVA & cod_iva() const { return _codiva; }
|
const TCodiceIVA & cod_iva() const { return _codiva; }
|
||||||
byte tipo(){ return _tipo; }// Tipo (Vedi opzioni per la selzione di filtro nella validate())
|
byte tipo() const { return _tipo; }// Tipo (Vedi opzioni per la selzione di filtro nella validate())
|
||||||
TRiepilogo_iva& operator = (const TRiepilogo_iva & a) { return copy(a); }
|
TRiepilogo_iva& operator = (const TRiepilogo_iva & a) { return copy(a); }
|
||||||
TRiepilogo_iva(const TCodiceIVA & codiva);
|
TRiepilogo_iva(const TCodiceIVA & codiva);
|
||||||
TRiepilogo_iva(const TRiepilogo_iva & a) { copy(a); }
|
TRiepilogo_iva(const TRiepilogo_iva & a) { copy(a); }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "vepriv.h"
|
#include "vepriv.h"
|
||||||
#include "../ca/commesse.h"
|
#include "../ca/commesse.h"
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "velib05.h"
|
#include "velib05.h"
|
||||||
|
#include <config.h>
|
||||||
#include <diction.h>
|
#include <diction.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
|
|
||||||
@ -49,6 +49,14 @@ void TDocumentoEsteso::compile_summary()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int riep_sort(const TSortable& o1, const TSortable& o2, void*)
|
||||||
|
{
|
||||||
|
const TRiepilogo_iva& r1 = (const TRiepilogo_iva&)o1;
|
||||||
|
const TRiepilogo_iva& r2 = (const TRiepilogo_iva&)o2;
|
||||||
|
const real delta = r1.imposta() - r2.imposta();
|
||||||
|
return delta.sign();
|
||||||
|
}
|
||||||
|
|
||||||
void TDocumentoEsteso::summary_filter(byte selector)
|
void TDocumentoEsteso::summary_filter(byte selector)
|
||||||
{
|
{
|
||||||
if (_sum_filter == -1)
|
if (_sum_filter == -1)
|
||||||
@ -63,15 +71,16 @@ void TDocumentoEsteso::summary_filter(byte selector)
|
|||||||
// Memorizza in un TString_array tante TToken_string quanti sono i filtri possibili
|
// Memorizza in un TString_array tante TToken_string quanti sono i filtri possibili
|
||||||
// (al massimo 31 [1+2+4+8+16]). Ogni TToken_string contiene i codici IVA
|
// (al massimo 31 [1+2+4+8+16]). Ogni TToken_string contiene i codici IVA
|
||||||
// delle righe di TRiepilogo_iva che soddisfano la condizione di filtro
|
// delle righe di TRiepilogo_iva che soddisfano la condizione di filtro
|
||||||
_sum_selected = TRUE;
|
_sum_selected = true;
|
||||||
_sum_filter = selector;
|
_sum_filter = selector;
|
||||||
CHECKD(_sum_filter > 0 && _sum_filter <= 32, "Bad selector ", _sum_filter);
|
CHECKD(_sum_filter > 0 && _sum_filter <= 32, "Bad selector ", _sum_filter);
|
||||||
TToken_string& codici = _order_array.row(_sum_filter-1);
|
TToken_string& codici = _order_array.row(_sum_filter-1);
|
||||||
if (codici.items() == 0) // Se non c'e' nemmeno un codice IVA allora deve effettuare il filtro
|
if (codici.blank()) // Se non c'e' nemmeno un codice IVA allora deve effettuare il filtro
|
||||||
{ // ovvero mette in <<codici>> tutti i codici IVA che soddisfano tale filtro
|
{ // ovvero mette in <<codici>> tutti i codici IVA che soddisfano tale filtro
|
||||||
// sara' poi la summary_set_next() a selezionare sequenzialmente il giusto codice a seconda del filtro corrente
|
// sara' poi la summary_set_next() a selezionare sequenzialmente il giusto codice a seconda del filtro corrente
|
||||||
|
|
||||||
// Scorre sequenzialmente la tabella _summary_table e compone la TToken_string con i codici IVA
|
// Scorre sequenzialmente la tabella _summary_table e compone la TToken_string con i codici IVA
|
||||||
|
/*
|
||||||
const int items = summary_items();
|
const int items = summary_items();
|
||||||
TRiepilogo_iva* curr = (TRiepilogo_iva *) _summary_table.first_item();
|
TRiepilogo_iva* curr = (TRiepilogo_iva *) _summary_table.first_item();
|
||||||
for (int i = 0; i < items && curr != NULL; i++)
|
for (int i = 0; i < items && curr != NULL; i++)
|
||||||
@ -80,6 +89,24 @@ void TDocumentoEsteso::summary_filter(byte selector)
|
|||||||
codici.add(curr->cod_iva().codice());
|
codici.add(curr->cod_iva().codice());
|
||||||
curr = (TRiepilogo_iva*) _summary_table.succ_item();
|
curr = (TRiepilogo_iva*) _summary_table.succ_item();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Ordina i riepiloghi in ordine descrescente di imposta (Da marzo 2016)
|
||||||
|
TPointer_array ri;
|
||||||
|
FOR_EACH_ASSOC_OBJECT(_summary_table, obj, key, itm)
|
||||||
|
{
|
||||||
|
TRiepilogo_iva* curr = (TRiepilogo_iva*)itm;
|
||||||
|
if (curr->tipo() & _sum_filter) // se fa parte del filtro selezionato schiaffa il codice nella lista
|
||||||
|
ri.add(curr);
|
||||||
|
}
|
||||||
|
ri.sort(riep_sort, NULL);
|
||||||
|
FOR_EACH_ARRAY_ITEM(ri, r, obj)
|
||||||
|
{
|
||||||
|
const TRiepilogo_iva* curr = (const TRiepilogo_iva*)obj;
|
||||||
|
codici.add(curr->cod_iva().codice());
|
||||||
|
}
|
||||||
|
// Fine ordinamento
|
||||||
|
|
||||||
codici.restart();
|
codici.restart();
|
||||||
summary_set_next(); // setta l'elemento corrente
|
summary_set_next(); // setta l'elemento corrente
|
||||||
}
|
}
|
||||||
@ -98,7 +125,7 @@ void TDocumentoEsteso::summary_reset(bool force)
|
|||||||
|
|
||||||
void TDocumentoEsteso::summary_set_next()
|
void TDocumentoEsteso::summary_set_next()
|
||||||
{
|
{
|
||||||
_sum_selected = FALSE;
|
_sum_selected = false;
|
||||||
TToken_string& codici = _order_array.row(_sum_filter-1);
|
TToken_string& codici = _order_array.row(_sum_filter-1);
|
||||||
|
|
||||||
const TString4 codiva(codici.get()); // Reperisce il prossimo codice nella lista. (son gia' ordinati per codice)
|
const TString4 codiva(codici.get()); // Reperisce il prossimo codice nella lista. (son gia' ordinati per codice)
|
||||||
|
@ -908,21 +908,18 @@ bool TDocumento_mask::on_key(KEY key)
|
|||||||
enable(DLG_SAVEREC);
|
enable(DLG_SAVEREC);
|
||||||
enable(DLG_DELREC);
|
enable(DLG_DELREC);
|
||||||
xvtil_statbar_set(TR("Modifica"));
|
xvtil_statbar_set(TR("Modifica"));
|
||||||
/*
|
|
||||||
TSmart_card * s = smartcard();
|
|
||||||
if (s != NULL && s->card_connected())
|
|
||||||
s->enable_prot_fields(*this);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
warning_box("L'utente %s non puo' modificare questo documento",
|
warning_box("L'utente %s non puo' modificare questo documento",
|
||||||
(const char*)user());
|
(const char*)user());
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
if (key == K_F7)
|
if (key == K_F7)
|
||||||
{
|
{
|
||||||
const TSheet_field & sf = sfield(F_SHEET);
|
const TSheet_field & sf = sfield(F_SHEET);
|
||||||
|
const int sel = sf.selected();
|
||||||
|
if (sel >= 0 && sel < sf.items())
|
||||||
|
{
|
||||||
TDocumento & d = doc();
|
TDocumento & d = doc();
|
||||||
TRiga_documento & riga = d[sf.selected() + 1];
|
TRiga_documento & riga = d[sf.selected() + 1];
|
||||||
TOriginal_row_mask sm;
|
TOriginal_row_mask sm;
|
||||||
@ -952,6 +949,7 @@ bool TDocumento_mask::on_key(KEY key)
|
|||||||
else
|
else
|
||||||
riga.set_original_rdoc_key(or_row_mod);
|
riga.set_original_rdoc_key(or_row_mod);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1199,10 +1197,24 @@ void TDocumento_mask::cli2mask(bool force_load)
|
|||||||
|
|
||||||
const bool split_payment = datadoc.year() >= 2015 && c.get_bool(CLI_SPLITPAY);
|
const bool split_payment = datadoc.year() >= 2015 && c.get_bool(CLI_SPLITPAY);
|
||||||
const bool ivadiff = !split_payment && ven_rec.get_bool(CFV_FATTSOSP);
|
const bool ivadiff = !split_payment && ven_rec.get_bool(CFV_FATTSOSP);
|
||||||
set(F_LIQDIFF, ivadiff ? "X" : "");
|
if (ivadiff)
|
||||||
|
{
|
||||||
|
TMask_field* ld = find_by_id(F_LIQDIFF);
|
||||||
|
if (ld)
|
||||||
|
{
|
||||||
|
const bool gld = ini_get_bool(CONFIG_DITTA, "cg", "GesLiqDiff");
|
||||||
|
if (gld != ld->active())
|
||||||
|
ld->enable(gld);
|
||||||
|
ld->set(gld ? "X" : "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TMask_field* ixc = find_by_id(F_IVAXCASSA);
|
||||||
|
if (ixc && ixc->active())
|
||||||
|
{
|
||||||
const bool IVAxCassa = !split_payment && !ivadiff && alleg < 5 && gestione_IVAxCassa(datadoc);
|
const bool IVAxCassa = !split_payment && !ivadiff && alleg < 5 && gestione_IVAxCassa(datadoc);
|
||||||
set(F_IVAXCASSA, IVAxCassa ? "X" : "");
|
ixc->set(IVAxCassa ? "X" : "");
|
||||||
|
}
|
||||||
|
|
||||||
pos = id2pos(F_CODLIST);
|
pos = id2pos(F_CODLIST);
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <smartcard.h>
|
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#include <toolfld.h>
|
#include <toolfld.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
@ -99,61 +98,6 @@ bool totdoc_hndl( TMask_field& field, KEY key )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cassato il macchinaro
|
|
||||||
bool smart_hndl( TMask_field& field, KEY key )
|
|
||||||
|
|
||||||
{
|
|
||||||
if (key == K_SPACE)
|
|
||||||
{
|
|
||||||
TDocumento_mask & m = (TDocumento_mask &) field.mask();
|
|
||||||
TSmart_card * s = m.smartcard();
|
|
||||||
|
|
||||||
if (s != NULL)
|
|
||||||
{
|
|
||||||
smartcard_error err = s->connect_card();
|
|
||||||
if (err == no_smarterror)
|
|
||||||
err = s->check_key(m);
|
|
||||||
if (err == no_smarterror)
|
|
||||||
{
|
|
||||||
s->card2mask(m);
|
|
||||||
if (s->with_card(m))
|
|
||||||
m.enable(DLG_SAVEREC);
|
|
||||||
m.disable(F_CODCF);
|
|
||||||
m.disable(F_RAGSOC);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s->display_error(err);
|
|
||||||
if (err == new_card)
|
|
||||||
if (m.get(F_CODCF).empty() && m.field(F_CODCF).on_key(K_F9) == false)
|
|
||||||
{
|
|
||||||
s->disconnect_card();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (key == K_ENTER)
|
|
||||||
{
|
|
||||||
TDocumento_mask & m = (TDocumento_mask &) field.mask();
|
|
||||||
TSmart_card * s = m.smartcard();
|
|
||||||
|
|
||||||
if (s != NULL && s->card_connected())
|
|
||||||
{
|
|
||||||
s->mask2card(m);
|
|
||||||
smartcard_error err = s->write();
|
|
||||||
if (err != no_smarterror)
|
|
||||||
s->display_error(err);
|
|
||||||
if (m.insert_mode() && m.doc().codice_numerazione().save_and_new())
|
|
||||||
s->disconnect_card();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool fido_hndl(TMask_field& field, KEY key)
|
bool fido_hndl(TMask_field& field, KEY key)
|
||||||
{
|
{
|
||||||
if (key == K_ENTER && !field.empty())
|
if (key == K_ENTER && !field.empty())
|
||||||
@ -464,11 +408,15 @@ bool data_hndl( TMask_field& field, KEY key )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Abilita IVA per cassa su modifica o inizializzazione DATADOC
|
// Abilita IVA per cassa su modifica o inizializzazione DATADOC
|
||||||
if (key == K_TAB && m.id2pos(F_IVAXCASSA) > 0)
|
TMask_field* ixc = m.find_by_id(F_IVAXCASSA);
|
||||||
|
if (key == K_TAB && ixc)
|
||||||
{
|
{
|
||||||
TDate d = field.get();
|
TDate d = field.get();
|
||||||
if (!d.ok()) d = TODAY;
|
if (!d.ok()) d = TODAY;
|
||||||
m.enable(F_IVAXCASSA, gestione_IVAxCassa(d));
|
ixc->enable(gestione_IVAxCassa(d));
|
||||||
|
|
||||||
|
const bool gld = ini_get_bool(CONFIG_DITTA, "cg", "GesLiqDiff");
|
||||||
|
m.enable(F_LIQDIFF, gld);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == K_ENTER || field.to_check(key))
|
if (key == K_ENTER || field.to_check(key))
|
||||||
|
@ -1,337 +0,0 @@
|
|||||||
#include "wxinc.h"
|
|
||||||
#include "wx/print.h"
|
|
||||||
#include "wx/printdlg.h"
|
|
||||||
|
|
||||||
#include "xvt.h"
|
|
||||||
#include "oslinux.h"
|
|
||||||
|
|
||||||
#include "xvt_menu.h"
|
|
||||||
#include "xvt_help.h"
|
|
||||||
#include "xvintern.h"
|
|
||||||
#include <wx/fontenum.h>
|
|
||||||
#include <wx/string.h>
|
|
||||||
#include <wx/snglinst.h>
|
|
||||||
#include <wx/utils.h>
|
|
||||||
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <mntent.h>
|
|
||||||
#include <sys/vfs.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
wxString OsLinux_File2App(const char* filename)
|
|
||||||
{
|
|
||||||
wxString app;
|
|
||||||
|
|
||||||
SORRY_BOX();
|
|
||||||
return app;
|
|
||||||
}
|
|
||||||
|
|
||||||
int OsLinux_EnumerateFamilies(char** families, int max_count)
|
|
||||||
{
|
|
||||||
wxFontEnumerator ef;
|
|
||||||
|
|
||||||
ef.EnumerateFacenames();
|
|
||||||
wxArrayString * fonts = ef.GetFacenames();
|
|
||||||
|
|
||||||
size_t items = fonts->GetCount();
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
for (i = 0; i < items; i++)
|
|
||||||
families[i] = xvt_str_duplicate((*fonts)[i].c_str());
|
|
||||||
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
int OsLinux_EnumerateSizes(const char* name, long* sizes, short* scalable, int max_count)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
*scalable = 1;
|
|
||||||
|
|
||||||
for (int size = 4; size < 80; size++)
|
|
||||||
sizes[i++] = size;
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OsLinux_PlaceProcessInWindow(unsigned int instance, const char* name, unsigned int parent)
|
|
||||||
{
|
|
||||||
SORRY_BOX();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OsLinux_UpdateWindow(unsigned int handle)
|
|
||||||
{
|
|
||||||
// non deve fare nulla in Linux, sembra di si verificare SORRY_BOX();
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
// Hardlock Support
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "hlapi_c.h"
|
|
||||||
|
|
||||||
bool OsLinux_HL_Login(unsigned short address, const unsigned char* label, const unsigned char* password)
|
|
||||||
{
|
|
||||||
int err = HL_LOGIN(address, LOCAL_DEVICE, (unsigned char*)label, (unsigned char*)password);
|
|
||||||
return err == STATUS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OsLinux_HL_Logout()
|
|
||||||
{
|
|
||||||
HL_LOGOUT();
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OsLinux_HL_Read(unsigned short reg, unsigned short* data)
|
|
||||||
{
|
|
||||||
int err = HL_READ(reg, data);
|
|
||||||
return err == STATUS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OsLinux_HL_ReadBlock(unsigned char* data)
|
|
||||||
{
|
|
||||||
int err = HL_READBL(data);
|
|
||||||
return err == STATUS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OsLinux_HL_Write(unsigned short reg, unsigned short data)
|
|
||||||
{
|
|
||||||
int err = HL_WRITE(reg, data);
|
|
||||||
return err == STATUS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OsLinux_HL_Crypt(unsigned short* data) // Array di 4 words (8 bytes)
|
|
||||||
{
|
|
||||||
int err = HL_CODE(data, 1);
|
|
||||||
return err == STATUS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
// Eutron Smartlink Support
|
|
||||||
///////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "skeylinux.h"
|
|
||||||
|
|
||||||
static SKEY_DATA skey;
|
|
||||||
|
|
||||||
bool OsLinux_SL_Crypt(unsigned short* data)
|
|
||||||
{
|
|
||||||
skey.command = SCRAMBLING_MODE;
|
|
||||||
memset(skey.data, 0, sizeof(skey.data));
|
|
||||||
memcpy(skey.data, data, 8);
|
|
||||||
clink(&skey);
|
|
||||||
const bool ok = (skey.status == ST_OK);
|
|
||||||
if (ok)
|
|
||||||
memcpy(data, skey.data, 8);
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OsLinux_SL_Login(const unsigned char* label, const unsigned char* password)
|
|
||||||
{
|
|
||||||
memset(&skey, 0, sizeof(SKEY_DATA));
|
|
||||||
skey.command = LOCATING_MODE;
|
|
||||||
skey.status = ST_HW_FAILURE; // Don't leave ST_OK = 0 here!
|
|
||||||
memcpy(skey.label, label, strlen((const char*)label));
|
|
||||||
memcpy(skey.password, password, strlen((const char*)password));
|
|
||||||
|
|
||||||
clink(&skey);
|
|
||||||
return skey.status == ST_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OsLinux_SL_Logout()
|
|
||||||
{
|
|
||||||
skey.command = 0;
|
|
||||||
clink(&skey);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OsLinux_SL_ReadBlock(unsigned short reg, unsigned short size, unsigned short* data)
|
|
||||||
{
|
|
||||||
skey.command = BLOCK_READING_MODE;
|
|
||||||
unsigned short* pointer = (unsigned short*)(&skey.data[0]);
|
|
||||||
unsigned short* number = (unsigned short*)(&skey.data[2]);
|
|
||||||
*pointer = reg;
|
|
||||||
*number = size;
|
|
||||||
clink(&skey);
|
|
||||||
const bool ok = skey.status == ST_OK;
|
|
||||||
if (ok)
|
|
||||||
memcpy(data, &skey.data[4], size*sizeof(unsigned short));
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OsLinux_SL_WriteBlock(unsigned short reg, unsigned short size, const unsigned short* data)
|
|
||||||
{
|
|
||||||
skey.command = BLOCK_WRITING_MODE;
|
|
||||||
unsigned short* pointer = (unsigned short*)(&skey.data[0]);
|
|
||||||
unsigned short* number = (unsigned short*)(&skey.data[2]);
|
|
||||||
*pointer = reg;
|
|
||||||
*number = size;
|
|
||||||
memcpy(&skey.data[4], data, size*sizeof(unsigned short));
|
|
||||||
clink(&skey);
|
|
||||||
return skey.status == ST_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OsLinux_GetFileSys(const char* path, char * dev, char * dir, char * type)
|
|
||||||
{
|
|
||||||
struct mntent *m;
|
|
||||||
FILE *f = setmntent("/etc/mnttab", "r");
|
|
||||||
|
|
||||||
while ((m = getmntent(f)) && strncmp(path, m->mnt_dir, strlen(m->mnt_dir)) != 0);
|
|
||||||
if (m)
|
|
||||||
{
|
|
||||||
if (dev) strcpy(dev, m->mnt_fsname);
|
|
||||||
if (dir) strcpy(dir, m->mnt_dir);
|
|
||||||
if (type) strcpy(type, m->mnt_type);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (dev) *dev = '\0';
|
|
||||||
if (dir) *dir = '\0';
|
|
||||||
if (type) *type = '\0';
|
|
||||||
}
|
|
||||||
endmntent(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool OsLinux_IsNetworkDrive(const char * path)
|
|
||||||
{
|
|
||||||
struct statfs buf;
|
|
||||||
|
|
||||||
if (statfs(path, &buf) == -1)
|
|
||||||
return FALSE;
|
|
||||||
return (buf.f_type == 0x6969 /*NFS_SUPER_MAGIC */) ||
|
|
||||||
(buf.f_type == 0x517B /*SMB_SUPER_MAGIC)*/);
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t OsLinux_GetDiskFreeSpace(const char * path)
|
|
||||||
{
|
|
||||||
struct statfs buf;
|
|
||||||
int64_t nBytes = 0L;
|
|
||||||
|
|
||||||
if (statfs(path, &buf) != -1)
|
|
||||||
{
|
|
||||||
nBytes = buf.f_bsize;
|
|
||||||
nBytes *= buf.f_bavail;
|
|
||||||
nBytes *= 1024;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nBytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "wx/settings.h"
|
|
||||||
#include "X11/Xutil.h"
|
|
||||||
|
|
||||||
#ifndef MWM_DECOR_BORDER
|
|
||||||
#define MWM_HINTS_FUNCTIONS (1L << 0)
|
|
||||||
#define MWM_HINTS_DECORATIONS (1L << 1)
|
|
||||||
#define MWM_HINTS_INPUT_MODE (1L << 2)
|
|
||||||
#define MWM_HINTS_STATUS (1L << 3)
|
|
||||||
#define MWM_DECOR_ALL (1L << 0)
|
|
||||||
#define MWM_DECOR_BORDER (1L << 1)
|
|
||||||
#define MWM_DECOR_RESIZEH (1L << 2)
|
|
||||||
#define MWM_DECOR_TITLE (1L << 3)
|
|
||||||
#define MWM_DECOR_MENU (1L << 4)
|
|
||||||
#define MWM_DECOR_MINIMIZE (1L << 5)
|
|
||||||
#define MWM_DECOR_MAXIMIZE (1L << 6)
|
|
||||||
#define MWM_FUNC_ALL (1L << 0)
|
|
||||||
#define MWM_FUNC_RESIZE (1L << 1)
|
|
||||||
#define MWM_FUNC_MOVE (1L << 2)
|
|
||||||
#define MWM_FUNC_MINIMIZE (1L << 3)
|
|
||||||
#define MWM_FUNC_MAXIMIZE (1L << 4)
|
|
||||||
#define MWM_FUNC_CLOSE (1L << 5)
|
|
||||||
#define MWM_INPUT_MODELESS 0
|
|
||||||
#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
|
|
||||||
#define MWM_INPUT_SYSTEM_MODAL 2
|
|
||||||
#define MWM_INPUT_FULL_APPLICATION_MODAL 3
|
|
||||||
#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL
|
|
||||||
#define MWM_TEAROFF_WINDOW (1L<<0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct MwmHints {
|
|
||||||
long flags;
|
|
||||||
long functions;
|
|
||||||
long decorations;
|
|
||||||
long input_mode;
|
|
||||||
};
|
|
||||||
#define PROP_MOTIF_WM_HINTS_ELEMENTS 5
|
|
||||||
// Set the window manager decorations according to the
|
|
||||||
// given wxWindows style
|
|
||||||
bool wxSetWMDecorations(Window w, long style)
|
|
||||||
{
|
|
||||||
Atom mwm_wm_hints = XInternAtom((Display * )wxGetDisplay(),"_MOTIF_WM_HINTS", False);
|
|
||||||
if (mwm_wm_hints == 0)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
MwmHints hints;
|
|
||||||
hints.flags = MWM_HINTS_DECORATIONS | MWM_HINTS_FUNCTIONS;
|
|
||||||
hints.decorations = 0;
|
|
||||||
hints.functions = 0;
|
|
||||||
|
|
||||||
// if ((style & wxSIMPLE_BORDER) || (style & wxNO_BORDER))
|
|
||||||
if (style & wxNO_BORDER)
|
|
||||||
{
|
|
||||||
// leave zeros
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hints.decorations = MWM_DECOR_BORDER;
|
|
||||||
hints.functions = MWM_FUNC_MOVE | MWM_FUNC_CLOSE;
|
|
||||||
if ((style & wxCAPTION) != 0)
|
|
||||||
hints.decorations |= MWM_DECOR_TITLE;
|
|
||||||
|
|
||||||
if ((style & wxSYSTEM_MENU) != 0)
|
|
||||||
{
|
|
||||||
hints.decorations |= MWM_DECOR_MENU;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((style & wxMINIMIZE_BOX) != 0)
|
|
||||||
{
|
|
||||||
hints.functions |= MWM_FUNC_MINIMIZE;
|
|
||||||
hints.decorations |= MWM_DECOR_MINIMIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((style & wxMAXIMIZE_BOX) != 0)
|
|
||||||
{
|
|
||||||
hints.functions |= MWM_FUNC_MAXIMIZE;
|
|
||||||
hints.decorations |= MWM_DECOR_MAXIMIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((style & wxRESIZE_BORDER) != 0)
|
|
||||||
{
|
|
||||||
hints.functions |= MWM_FUNC_RESIZE;
|
|
||||||
hints.decorations |= MWM_DECOR_RESIZEH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
XChangeProperty((Display *) wxGetDisplay(), w, mwm_wm_hints, mwm_wm_hints, 32, PropModeReplace,
|
|
||||||
(unsigned char *) &hints, PROP_MOTIF_WM_HINTS_ELEMENTS);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <gdk/gdk.h>
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
#include <gdk/gdkx.h>
|
|
||||||
|
|
||||||
void OsLinux_SetCaptionStyle(wxWindow * w, long style)
|
|
||||||
{
|
|
||||||
wxSetWMDecorations(GDK_WINDOW_XID(w->m_widget->window), style);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int OsLinux_GetSessionId()
|
|
||||||
{
|
|
||||||
char s[256];
|
|
||||||
wxStrncpy(s, wxGetEnv("DISPLAY"), sizeof(s));
|
|
||||||
|
|
||||||
char* p = strchr(s, ':');
|
|
||||||
if (p == NULL)
|
|
||||||
p = s;
|
|
||||||
else
|
|
||||||
p++;
|
|
||||||
|
|
||||||
char * e = strchr(p, '.');
|
|
||||||
|
|
||||||
if (e != NULL)
|
|
||||||
*e = '\0';
|
|
||||||
|
|
||||||
return atoi(p);
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
wxString OsLinux_File2App(const char* filename);
|
|
||||||
|
|
||||||
int OsLinux_EnumerateFamilies(char** families, int max_count);
|
|
||||||
int OsLinux_EnumerateSizes(const char* name, long* sizes, short* scalable, int max_count);
|
|
||||||
|
|
||||||
void OsLinux_PlaceProcessInWindow(unsigned int instance, const char* name, unsigned int parent);
|
|
||||||
void OsLinux_UpdateWindow(unsigned int handle);
|
|
||||||
|
|
||||||
bool OsLinux_HL_Crypt(unsigned short* data);
|
|
||||||
bool OsLinux_HL_Login(unsigned short address, const unsigned char* label, const unsigned char* password);
|
|
||||||
bool OsLinux_HL_Logout() ;
|
|
||||||
bool OsLinux_HL_Read(unsigned short reg, unsigned short* data);
|
|
||||||
bool OsLinux_HL_ReadBlock(unsigned char* data);
|
|
||||||
bool OsLinux_HL_Write(unsigned short reg, unsigned short data);
|
|
||||||
bool OsLinux_SL_Crypt(unsigned short* data);
|
|
||||||
bool OsLinux_SL_Login(const unsigned char* label, const unsigned char* password);
|
|
||||||
bool OsLinux_SL_Logout() ;
|
|
||||||
bool OsLinux_SL_ReadBlock(unsigned short reg, unsigned short size, unsigned short* data);
|
|
||||||
bool OsLinux_SL_WriteBlock(unsigned short reg, unsigned short size, const unsigned short* data);
|
|
||||||
void OsLinux_GetFileSys(const char* path, char * dev, char * dir, char * type);
|
|
||||||
bool OsLinux_IsNetworkDrive(const char * path);
|
|
||||||
int64_t OsLinux_GetDiskFreeSpace(const char * path);
|
|
||||||
void OsLinux_SetCaptionStyle(wxWindow * w, long style);
|
|
||||||
int OsLinux_GetSessionId();
|
|
||||||
|
|
146
xvaga/skeylink.h
146
xvaga/skeylink.h
@ -1,146 +0,0 @@
|
|||||||
/*
|
|
||||||
* SmartKey Multilan Driver
|
|
||||||
* Copyright EUTRON 2003
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __SKEYLINK_H
|
|
||||||
#define __SKEYLINK_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAKE_KEY_CODE(low,high) (((unsigned short)(low)) | (((unsigned short)(high)) << 8))
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Commands
|
|
||||||
*/
|
|
||||||
#define SCRAMBLING_MODE 's'
|
|
||||||
#define READING_MODE 'r'
|
|
||||||
#define WRITING_MODE 'w'
|
|
||||||
#define FIXING_MODE 'f'
|
|
||||||
#define LOCATING_MODE 'l'
|
|
||||||
#define COMPARING_MODE 'c'
|
|
||||||
#define PROGRAMMING_MODE 'p'
|
|
||||||
#define MODEL_READING_MODE 'm'
|
|
||||||
#define ENCRYPTING_MODE 'e'
|
|
||||||
#define BLOCK_READING_MODE MAKE_KEY_CODE('b','r')
|
|
||||||
#define BLOCK_WRITING_MODE MAKE_KEY_CODE('b','w')
|
|
||||||
#define SERIAL_NUMBER_READING_MODE 'n'
|
|
||||||
#define FIX_READING_MODE 'x'
|
|
||||||
#define EXT_MODEL_READING_MODE 'h'
|
|
||||||
#define FAIL_COUNTER_READING_MODE 'a'
|
|
||||||
#define AES_SET_MODE 'g'
|
|
||||||
#define AES_SCRAMBLE_MODE 'o'
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Models
|
|
||||||
*/
|
|
||||||
#define SKEY_FX '1' /* Model FX */
|
|
||||||
#define SKEY_PR '2' /* Model PR */
|
|
||||||
#define SKEY_EP '3' /* Model EP */
|
|
||||||
#define SKEY_SP '9' /* Model SP */
|
|
||||||
#define SKEY_XM 'D' /* Model XM */
|
|
||||||
#define SKEY_NET 'A' /* Model NET */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Memory sizes
|
|
||||||
*/
|
|
||||||
#define SKEY_MEMORY_NONE '0' /* No memory */
|
|
||||||
#define SKEY_MEMORY_64 '1' /* 64 bytes of memory */
|
|
||||||
#define SKEY_MEMORY_128 '2' /* 128 bytes of memory */
|
|
||||||
#define SKEY_MEMORY_416 '3' /* 416 bytes of memory */
|
|
||||||
#define SKEY_MEMORY_896 '4' /* 896 bytes of memory */
|
|
||||||
#define SKEY_MEMORY_8192 '8' /* 8192 bytes of memory */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return codes
|
|
||||||
*/
|
|
||||||
#define ST_OK 0 /* No errors */
|
|
||||||
#define ST_NONE_KEY -1 /* No Smartkey present */
|
|
||||||
#define ST_SYNT_ERR -2 /* Syntax error */
|
|
||||||
#define ST_LABEL_FAILED -3 /* Uncorrect label */
|
|
||||||
#define ST_PW_DATA_FAILED -4 /* Uncorrect password or data */
|
|
||||||
#define ST_EXEC_ERROR -16 /* Max executions reached */
|
|
||||||
#define ST_HW_FAILURE -20 /* Hardware error */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Field length
|
|
||||||
*/
|
|
||||||
#define LABEL_LENGTH 16
|
|
||||||
#define PASSWORD_LENGTH 16
|
|
||||||
#define DATA_LENGTH 64
|
|
||||||
#define EXTENDED_DATA_LENGTH 352
|
|
||||||
#define SCRAMBLE_LENGTH 8
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Net modes
|
|
||||||
*/
|
|
||||||
#define NET_KEY_OPEN 'O'
|
|
||||||
#define NET_KEY_ACCESS 'A'
|
|
||||||
#define NET_KEY_CLOSE 'C'
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Net commands
|
|
||||||
*/
|
|
||||||
#define USER_NUMBER_MODE 'U'
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Net return codes
|
|
||||||
*/
|
|
||||||
#define ST_NET_ERROR -5 /* Lan error */
|
|
||||||
#define ST_CLOSE_ERROR -6 /* Attempting to CLOSE without OPENing */
|
|
||||||
#define ST_ACCESS_ERROR -7 /* Attempting to ACCESS without OPENing */
|
|
||||||
#define ST_USER_ERROR -8 /* Max user reached */
|
|
||||||
#define ST_NET_PWD_ERR -9 /* Net password wrong */
|
|
||||||
#define ST_INIT_ERROR -11 /* Initialization error */
|
|
||||||
#define ST_TOO_MANY_OPEN_KEY -14 /* Too many open SmartKey */
|
|
||||||
#define ST_NET_PASS_INVALID -15 /* Invalid net password */
|
|
||||||
#define ST_NET_CONF_ERROR -21 /* Configuration error in INI/Registry/Environment */
|
|
||||||
#define ST_NET_ANP_INIT_ERROR -22 /* Error inizializing the ANP protocol */
|
|
||||||
#define ST_NET_TCPIP_INIT_ERROR -23 /* Error inizializing the TCPIP protocol */
|
|
||||||
#define ST_NET_NOVELL_INIT_ERROR -24 /* Error inizializing the Novell protocol */
|
|
||||||
#define ST_NET_LOCAL_INIT_ERROR -25 /* Error inizializing the Local protocol */
|
|
||||||
#define ST_NET_KEY_NOT_MAP -26 /* Not MAP programmed key found when MAP is requested */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Code returned in data[0] after NET_OPEN
|
|
||||||
*/
|
|
||||||
#define NET_TYPE_LOCAL 0
|
|
||||||
#define NET_TYPE_IPX 1
|
|
||||||
#define NET_TYPE_ANP 2
|
|
||||||
#define NET_TYPE_TCPIP 3
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Net command structure
|
|
||||||
*/
|
|
||||||
#pragma pack(push,1)
|
|
||||||
|
|
||||||
typedef struct __KEY_NET {
|
|
||||||
short net_command;
|
|
||||||
unsigned long net_password;
|
|
||||||
short lpt;
|
|
||||||
short command;
|
|
||||||
unsigned char label[LABEL_LENGTH];
|
|
||||||
unsigned char password[PASSWORD_LENGTH];
|
|
||||||
unsigned char data[DATA_LENGTH];
|
|
||||||
short fail_counter;
|
|
||||||
short status;
|
|
||||||
unsigned char ext_data[EXTENDED_DATA_LENGTH];
|
|
||||||
} KEY_NET;
|
|
||||||
|
|
||||||
#pragma pack(pop)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Command function.
|
|
||||||
* It executes the command and returns key->status code.
|
|
||||||
*
|
|
||||||
* short smartlink(KEY_NET* key)
|
|
||||||
*/
|
|
||||||
short __cdecl smartlink(KEY_NET*);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,84 +0,0 @@
|
|||||||
#ifndef __SKEYLINK_H
|
|
||||||
#define __SKEYLINK_H
|
|
||||||
|
|
||||||
#ifndef __SKEYDRV_H
|
|
||||||
#define __SKEYDRV_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Smartkey mode codes */
|
|
||||||
|
|
||||||
#define SCRAMBLING_MODE 's'
|
|
||||||
#define READING_MODE 'r'
|
|
||||||
#define WRITING_MODE 'w'
|
|
||||||
#define FIXING_MODE 'f'
|
|
||||||
#define LOCATING_MODE 'l'
|
|
||||||
#define COMPARING_MODE 'c'
|
|
||||||
#define PROGRAMMING_MODE 'p'
|
|
||||||
#define MODEL_READING_MODE 'm'
|
|
||||||
#define ENCRYPTING_MODE 'e'
|
|
||||||
#define SERIAL_NUMBER_READING_MODE 'n'
|
|
||||||
#define FIX_READING_MODE 'x'
|
|
||||||
#define EXT_MODEL_READING_MODE 'h'
|
|
||||||
#define FAIL_COUNTER_READING_MODE 'a'
|
|
||||||
#define BLOCK_READING_MODE ('b' | ((unsigned)'r' << 8))
|
|
||||||
#define BLOCK_WRITING_MODE ('b' | ((unsigned)'w' << 8))
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Smartkey models */
|
|
||||||
|
|
||||||
#define SKEY_NONE '0' /* No Smartkey */
|
|
||||||
#define SKEY_FX '1' /* Smartkey mod. FX */
|
|
||||||
#define SKEY_PR '2' /* Smartkey mod. PR */
|
|
||||||
#define SKEY_EP '3' /* Smartkey mod. EP */
|
|
||||||
#define SKEY_SP '9' /* Smartkey mod. SP */
|
|
||||||
#define SKEY_NET 'A' /* Smartkey mod. NET */
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Return codes */
|
|
||||||
|
|
||||||
#define ST_OK 0 /* No errors */
|
|
||||||
#define ST_NONE_KEY -1 /* No Smartkey present */
|
|
||||||
#define ST_SYNT_ERR -2 /* Syntax error */
|
|
||||||
#define ST_LABEL_FAILED -3 /* Uncorrect label */
|
|
||||||
#define ST_PW_DATA_FAILED -4 /* Uncorrect password or data */
|
|
||||||
#define ST_HW_FAILURE -20 /* Smartkey damaged */
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Field length */
|
|
||||||
|
|
||||||
#define LABEL_LENGTH 16
|
|
||||||
#define PASSWORD_LENGTH 16
|
|
||||||
#define DATA_LENGTH 64
|
|
||||||
#define EXTENDED_DATA_LENGTH 352
|
|
||||||
#define SCRAMBLE_LENGTH 8
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Communication structure definition */
|
|
||||||
|
|
||||||
typedef struct smartkey {
|
|
||||||
short lpt;
|
|
||||||
short command;
|
|
||||||
unsigned char label[LABEL_LENGTH];
|
|
||||||
unsigned char password[PASSWORD_LENGTH];
|
|
||||||
unsigned char data[DATA_LENGTH];
|
|
||||||
short fail_counter;
|
|
||||||
short status;
|
|
||||||
unsigned char ext_data[EXTENDED_DATA_LENGTH];
|
|
||||||
} SKEY_DATA;
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Interface function prototype */
|
|
||||||
|
|
||||||
int clink(SKEY_DATA*);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -46,6 +46,7 @@ XVTDLL WINDOW xvt_toolbar_create(int cid, int left, int top, int right, int bot
|
|||||||
long style, WINDOW parent_win);
|
long style, WINDOW parent_win);
|
||||||
XVTDLL void xvt_toolbar_enable_control(WINDOW win, int cid, BOOLEAN on);
|
XVTDLL void xvt_toolbar_enable_control(WINDOW win, int cid, BOOLEAN on);
|
||||||
XVTDLL void xvt_toolbar_realize(WINDOW win);
|
XVTDLL void xvt_toolbar_realize(WINDOW win);
|
||||||
|
XVTDLL BOOLEAN xvt_toolbar_remove_control(WINDOW win, int cid);
|
||||||
XVTDLL BOOLEAN xvt_toolbar_set_last_tool(WINDOW win, int cid);
|
XVTDLL BOOLEAN xvt_toolbar_set_last_tool(WINDOW win, int cid);
|
||||||
XVTDLL void xvt_toolbar_show_control(WINDOW win, int cid, BOOLEAN on);
|
XVTDLL void xvt_toolbar_show_control(WINDOW win, int cid, BOOLEAN on);
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ void xvt_app_destroy(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
// Evita noiosa finestra d'errore che succede solo a Press Color
|
// Evita noiosa finestra d'errore che succede solo a PressColor
|
||||||
::SetErrorMode(SEM_NOGPFAULTERRORBOX);
|
::SetErrorMode(SEM_NOGPFAULTERRORBOX);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -798,7 +798,7 @@ void xvt_dwin_draw_icon_rect(WINDOW win, RCT* rct, int rid)
|
|||||||
if (ico.IsOk())
|
if (ico.IsOk())
|
||||||
{
|
{
|
||||||
CAST_DC(win, dc);
|
CAST_DC(win, dc);
|
||||||
dc.DrawIcon(ico, rct->left+(w-s)/2, rct->top+(h-s)/2);
|
dc.DrawIcon(ico, rct->left+(w-ico.GetWidth())/2, rct->top+(h-ico.GetHeight())/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1713,7 +1713,6 @@ long xvt_fsys_file_attr(const char* path, long attr)
|
|||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
SLIST_ELT e = xvt_slist_get_first(files);
|
SLIST_ELT e = xvt_slist_get_first(files);
|
||||||
|
|
||||||
ret = e->data;
|
ret = e->data;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2620,6 +2619,8 @@ XVT_IMAGE xvt_res_get_icon(int rid)
|
|||||||
wxBitmap bmp(w, h, icon.GetDepth());
|
wxBitmap bmp(w, h, icon.GetDepth());
|
||||||
{
|
{
|
||||||
wxMemoryDC dc(bmp);
|
wxMemoryDC dc(bmp);
|
||||||
|
dc.SetBackground(*wxWHITE_BRUSH);
|
||||||
|
dc.Clear();
|
||||||
dc.DrawIcon(icon, 0, 0);
|
dc.DrawIcon(icon, 0, 0);
|
||||||
}
|
}
|
||||||
XVT_IMAGE_FORMAT xif = bmp.GetDepth()>8 ? XVT_IMAGE_RGB : XVT_IMAGE_CL8;
|
XVT_IMAGE_FORMAT xif = bmp.GetDepth()>8 ? XVT_IMAGE_RGB : XVT_IMAGE_CL8;
|
||||||
|
@ -226,13 +226,14 @@ WC_VGAUGE, /* vertical progress bar */
|
|||||||
WC_NOTEBK, /* notebook control */
|
WC_NOTEBK, /* notebook control */
|
||||||
WC_HTML, /* HTML control */
|
WC_HTML, /* HTML control */
|
||||||
WC_TREE, /* tree view */
|
WC_TREE, /* tree view */
|
||||||
WC_OUTLOOKBAR, /* Barra di outlook */
|
WC_OUTLOOKBAR, /* Barra di Outlook */
|
||||||
WC_HSLIDER, /* horizontal slider control */
|
WC_HSLIDER, /* horizontal slider control */
|
||||||
WC_VSLIDER, /* vertical slider control */
|
WC_VSLIDER, /* vertical slider control */
|
||||||
WC_POPUP, /* list of listedit control or popup menu */
|
WC_POPUP, /* list of listedit control or popup menu */
|
||||||
WC_PROPGRID, /* property grid */
|
WC_PROPGRID, /* property grid */
|
||||||
WC_MVC, /* model view controller */
|
WC_MVC, /* model view controller */
|
||||||
WC_TREELIST, /* tree list */
|
WC_TREELIST, /* tree list */
|
||||||
|
WC_METROBAR, /* Barra di Metro */
|
||||||
} WIN_TYPE;
|
} WIN_TYPE;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
386
xvaga/xvtctl.cpp
386
xvaga/xvtctl.cpp
@ -48,9 +48,11 @@ static wxBitmap Image2Bitmap(XVT_IMAGE image, int maxx, int maxy, BOOLEAN trans)
|
|||||||
|
|
||||||
static int RoundToIcon(int nSize)
|
static int RoundToIcon(int nSize)
|
||||||
{
|
{
|
||||||
nSize = ((nSize+3) / 8) * 8;
|
nSize = (nSize/16) * 16;
|
||||||
if (nSize < 16) nSize = 16;
|
if (nSize < 16)
|
||||||
if (nSize > 128) nSize = 128;
|
nSize = 16; else
|
||||||
|
if (nSize > 128)
|
||||||
|
nSize = 128;
|
||||||
return nSize;
|
return nSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +144,7 @@ private:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
DECLARE_EVENT_TABLE();
|
DECLARE_EVENT_TABLE();
|
||||||
void OnExpanding(wxTreeEvent& e); // Called when node in about to be expanded
|
void OnExpanding(wxTreeEvent& e); // Called when node is about to be expanded
|
||||||
void OnCollapsed(wxTreeEvent& e); // Called when node is collapsed
|
void OnCollapsed(wxTreeEvent& e); // Called when node is collapsed
|
||||||
void OnSelected(wxTreeEvent& e); // Calls OnClick(e, false)
|
void OnSelected(wxTreeEvent& e); // Calls OnClick(e, false)
|
||||||
void OnActivated(wxTreeEvent& e); // Calls OnClick(e, true)
|
void OnActivated(wxTreeEvent& e); // Calls OnClick(e, true)
|
||||||
@ -196,11 +198,14 @@ struct TwxOutlookItem
|
|||||||
|
|
||||||
class TwxOutlookBar : public wxVListBox
|
class TwxOutlookBar : public wxVListBox
|
||||||
{
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(TwxOutlookBar);
|
||||||
|
|
||||||
enum { MAX_ITEMS = 32 };
|
enum { MAX_ITEMS = 32 };
|
||||||
TwxOutlookItem m_item[MAX_ITEMS];
|
TwxOutlookItem m_item[MAX_ITEMS];
|
||||||
int m_nHovering;
|
int m_nHovering;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
TwxOutlookBar() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const;
|
virtual void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const;
|
||||||
@ -217,6 +222,40 @@ public:
|
|||||||
~TwxOutlookBar();
|
~TwxOutlookBar();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class TwxMetroBar : public wxWindow
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(TwxMetroBar);
|
||||||
|
|
||||||
|
enum { MAX_ITEMS = 32 };
|
||||||
|
TwxOutlookItem m_item[MAX_ITEMS];
|
||||||
|
int m_nItems, m_nCurr, m_nHover;
|
||||||
|
int m_nRows, m_nCols, m_nWidth, m_nHeight;
|
||||||
|
wxColour m_rgbBorder, m_rgbSelectFore;
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
TwxMetroBar() {}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void OnPaint(wxPaintEvent& e);
|
||||||
|
void OnMouseDown(wxMouseEvent& e);
|
||||||
|
void OnMouseMove(wxMouseEvent& e);
|
||||||
|
void OnMouseLeave(wxMouseEvent& e);
|
||||||
|
void OnResize(wxSizeEvent& e);
|
||||||
|
wxRect GetRect(int i) const;
|
||||||
|
void DrawCell(wxDC& dc, int i) const;
|
||||||
|
int HitTest(const wxPoint& pt) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void Clear() { m_nItems = 0; }
|
||||||
|
void SetSelection(int i, bool sel) { if (sel) m_nCurr = (i >= 0 && i < m_nItems) ? i : 0; }
|
||||||
|
int GetSelection() const { return m_nCurr; }
|
||||||
|
int Add(short nIconId, const wxString strText, int nFlags);
|
||||||
|
int GetItemCount() const { return m_nItems; }
|
||||||
|
void SetSelectForeColor(const wxColour& rgb) { m_rgbSelectFore = rgb; }
|
||||||
|
void SetBorderColor(const wxColour& rgb) { m_rgbBorder = rgb; }
|
||||||
|
TwxMetroBar(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
|
||||||
|
};
|
||||||
|
|
||||||
class TwxPopUp : public wxVListBox
|
class TwxPopUp : public wxVListBox
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(TwxPopUp);
|
DECLARE_DYNAMIC_CLASS(TwxPopUp);
|
||||||
@ -351,6 +390,13 @@ WINDOW xvt_ctl_create_def(WIN_DEF* win_def_p, WINDOW parent_win, long app_data)
|
|||||||
win = (WINDOW)tob;
|
win = (WINDOW)tob;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case WC_METROBAR:
|
||||||
|
{
|
||||||
|
long style = 0;
|
||||||
|
TwxMetroBar* tmb = new TwxMetroBar(pParent, id, rct.GetPosition(), rct.GetSize(), style);
|
||||||
|
win = (WINDOW)tmb;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case WC_POPUP:
|
case WC_POPUP:
|
||||||
{
|
{
|
||||||
TwxPopUp* tpu = new TwxPopUp(pParent, id, rct.GetPosition(), rct.GetSize());
|
TwxPopUp* tpu = new TwxPopUp(pParent, id, rct.GetPosition(), rct.GetSize());
|
||||||
@ -444,6 +490,12 @@ void xvt_ctl_set_colors(WINDOW win, const XVT_COLOR_COMPONENT* colors, XVT_COLOR
|
|||||||
TwxPopUp* tpu = wxDynamicCast(w, TwxPopUp);
|
TwxPopUp* tpu = wxDynamicCast(w, TwxPopUp);
|
||||||
if (tpu != NULL)
|
if (tpu != NULL)
|
||||||
tpu->SetSelectForeColor(rgb);
|
tpu->SetSelectForeColor(rgb);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TwxMetroBar* tmb = wxDynamicCast(w, TwxMetroBar);
|
||||||
|
if (tmb != NULL)
|
||||||
|
tmb->SetSelectForeColor(rgb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XVT_COLOR_SELECT:
|
case XVT_COLOR_SELECT:
|
||||||
@ -457,6 +509,13 @@ void xvt_ctl_set_colors(WINDOW win, const XVT_COLOR_COMPONENT* colors, XVT_COLOR
|
|||||||
if (!w->IsKindOf(CLASSINFO(wxButton)))
|
if (!w->IsKindOf(CLASSINFO(wxButton)))
|
||||||
w->SetOwnBackgroundColour(rgb);
|
w->SetOwnBackgroundColour(rgb);
|
||||||
break;
|
break;
|
||||||
|
case XVT_COLOR_BORDER:
|
||||||
|
{
|
||||||
|
TwxMetroBar* tmb = wxDynamicCast(w, TwxMetroBar);
|
||||||
|
if (tmb != NULL)
|
||||||
|
tmb->SetBorderColor(rgb);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -660,18 +719,34 @@ XVTDLL BOOLEAN xvt_pane_set_size_range(WINDOW win, int min_size, int best_size,
|
|||||||
class TwxAuiDefaultTabArt : public wxAuiDefaultTabArt
|
class TwxAuiDefaultTabArt : public wxAuiDefaultTabArt
|
||||||
{
|
{
|
||||||
wxColour m_fore_colour;
|
wxColour m_fore_colour;
|
||||||
|
bool m_metro_style;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& pane,
|
virtual void DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& pane,
|
||||||
const wxRect& in_rect, int close_button_state,
|
const wxRect& in_rect, int close_button_state,
|
||||||
wxRect* out_tab_rect, wxRect* out_button_rect, int* x_extent);
|
wxRect* out_tab_rect, wxRect* out_button_rect, int* x_extent);
|
||||||
|
virtual void DrawBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void SetBackgroundColour(const wxColor& colour) { m_base_colour = colour; }
|
void SetBackgroundColour(const wxColor& colour) { m_base_colour = colour; }
|
||||||
void SetForegroundColour(const wxColor& colour) { m_fore_colour = colour; }
|
void SetForegroundColour(const wxColor& colour) { m_fore_colour = colour; }
|
||||||
|
void SetMetroStyle(bool ms) { m_metro_style = ms; }
|
||||||
virtual wxAuiTabArt* Clone();
|
virtual wxAuiTabArt* Clone();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void TwxAuiDefaultTabArt::DrawBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect)
|
||||||
|
{
|
||||||
|
if (m_metro_style)
|
||||||
|
{
|
||||||
|
// dc.SetBackground(m_base_colour); dc.Clear();
|
||||||
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
|
dc.SetBrush(m_base_colour);
|
||||||
|
dc.DrawRectangle(rect);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
wxAuiDefaultTabArt::DrawBackground(dc, wnd, rect);
|
||||||
|
}
|
||||||
|
|
||||||
void TwxAuiDefaultTabArt::DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& pane,
|
void TwxAuiDefaultTabArt::DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& pane,
|
||||||
const wxRect& in_rect, int close_button_state,
|
const wxRect& in_rect, int close_button_state,
|
||||||
wxRect* out_tab_rect, wxRect* out_button_rect, int* x_extent)
|
wxRect* out_tab_rect, wxRect* out_button_rect, int* x_extent)
|
||||||
@ -694,6 +769,7 @@ wxAuiTabArt* TwxAuiDefaultTabArt::Clone()
|
|||||||
// My own addition
|
// My own addition
|
||||||
art->m_base_colour = m_base_colour;
|
art->m_base_colour = m_base_colour;
|
||||||
art->m_fore_colour = m_fore_colour;
|
art->m_fore_colour = m_fore_colour;
|
||||||
|
art->SetMetroStyle(m_metro_style);
|
||||||
|
|
||||||
return art;
|
return art;
|
||||||
}
|
}
|
||||||
@ -861,7 +937,9 @@ TwxNoteBook::TwxNoteBook(wxWindow *parent, wxWindowID id,
|
|||||||
const wxPoint& pos, const wxSize& size, long flags)
|
const wxPoint& pos, const wxSize& size, long flags)
|
||||||
: wxAuiNotebook(parent, id, pos, size, Flags2Style(flags)), m_bSuspended(false)
|
: wxAuiNotebook(parent, id, pos, size, Flags2Style(flags)), m_bSuspended(false)
|
||||||
{
|
{
|
||||||
SetArtProvider(new TwxAuiDefaultTabArt);
|
TwxAuiDefaultTabArt* dta = new TwxAuiDefaultTabArt;
|
||||||
|
dta->SetMetroStyle((flags & WSF_NO_TASKBAR) != 0);
|
||||||
|
SetArtProvider(dta);
|
||||||
_nice_windows.Put((WINDOW)this, this); // Serve per poter fare la xvt_vobj_destroy
|
_nice_windows.Put((WINDOW)this, this); // Serve per poter fare la xvt_vobj_destroy
|
||||||
|
|
||||||
wxAuiTabCtrl* atc = GetActiveTabCtrl();
|
wxAuiTabCtrl* atc = GetActiveTabCtrl();
|
||||||
@ -1554,6 +1632,8 @@ XVT_TREEVIEW_NODE xvt_treeview_find_node_string(WINDOW win, const char* text)
|
|||||||
// TwxOutlookBar
|
// TwxOutlookBar
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(TwxOutlookBar, wxVListBox)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(TwxOutlookBar, wxVListBox)
|
BEGIN_EVENT_TABLE(TwxOutlookBar, wxVListBox)
|
||||||
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_SELECTED, TwxOutlookBar::OnSelected)
|
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_SELECTED, TwxOutlookBar::OnSelected)
|
||||||
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, TwxOutlookBar::OnSelected)
|
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, TwxOutlookBar::OnSelected)
|
||||||
@ -1785,6 +1865,12 @@ int xvt_list_add_item(WINDOW win, short icon, const char* text, int flags)
|
|||||||
TwxOutlookBar* olb = wxDynamicCast((wxObject*)win, TwxOutlookBar);
|
TwxOutlookBar* olb = wxDynamicCast((wxObject*)win, TwxOutlookBar);
|
||||||
if (olb != NULL)
|
if (olb != NULL)
|
||||||
n = olb->Add(icon, text, flags);
|
n = olb->Add(icon, text, flags);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TwxMetroBar* mb = wxDynamicCast((wxObject*)win, TwxMetroBar);
|
||||||
|
if (mb != NULL)
|
||||||
|
n = mb->Add(icon, text, flags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
@ -1802,6 +1888,12 @@ BOOLEAN xvt_list_clear(WINDOW win)
|
|||||||
wxListBox* lb = wxDynamicCast((wxObject*)win, wxListBox);
|
wxListBox* lb = wxDynamicCast((wxObject*)win, wxListBox);
|
||||||
if (lb != NULL)
|
if (lb != NULL)
|
||||||
lb->Clear();
|
lb->Clear();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TwxMetroBar* mb = wxDynamicCast((wxObject*)win, TwxMetroBar);
|
||||||
|
if (mb != NULL)
|
||||||
|
mb->Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
@ -1820,6 +1912,12 @@ int xvt_list_get_sel_index(WINDOW win)
|
|||||||
wxListBox* lb = wxDynamicCast((wxObject*)win, wxListBox);
|
wxListBox* lb = wxDynamicCast((wxObject*)win, wxListBox);
|
||||||
if (lb != NULL)
|
if (lb != NULL)
|
||||||
sel = lb->GetSelection();
|
sel = lb->GetSelection();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TwxMetroBar* mb = wxDynamicCast((wxObject*)win, TwxMetroBar);
|
||||||
|
if (mb != NULL)
|
||||||
|
sel = mb->GetSelection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sel;
|
return sel;
|
||||||
@ -1841,6 +1939,12 @@ BOOLEAN xvt_list_set_sel(WINDOW win, int index, BOOLEAN select)
|
|||||||
wxListBox* lb = wxDynamicCast((wxObject*)win, wxListBox);
|
wxListBox* lb = wxDynamicCast((wxObject*)win, wxListBox);
|
||||||
if (lb != NULL)
|
if (lb != NULL)
|
||||||
lb->SetSelection(index, select != 0);
|
lb->SetSelection(index, select != 0);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TwxMetroBar* mb = wxDynamicCast((wxObject*)win, TwxMetroBar);
|
||||||
|
if (mb != NULL)
|
||||||
|
mb->SetSelection(index, select!=0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
@ -1859,11 +1963,232 @@ int xvt_list_count(WINDOW win)
|
|||||||
wxListBox* lb = wxDynamicCast((wxObject*)win, wxListBox);
|
wxListBox* lb = wxDynamicCast((wxObject*)win, wxListBox);
|
||||||
if (lb != NULL)
|
if (lb != NULL)
|
||||||
n = lb->GetCount();
|
n = lb->GetCount();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TwxMetroBar* mb = wxDynamicCast((wxObject*)win, TwxMetroBar);
|
||||||
|
if (mb != NULL)
|
||||||
|
mb->GetItemCount();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TwxMetroBar
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(TwxMetroBar, wxWindow)
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(TwxMetroBar, wxWindow)
|
||||||
|
EVT_SIZE(TwxMetroBar::OnResize)
|
||||||
|
EVT_PAINT(TwxMetroBar::OnPaint)
|
||||||
|
EVT_MOTION(TwxMetroBar::OnMouseMove)
|
||||||
|
EVT_LEAVE_WINDOW(TwxMetroBar::OnMouseLeave)
|
||||||
|
EVT_LEFT_DOWN(TwxMetroBar::OnMouseDown)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
void TwxMetroBar::OnResize(wxSizeEvent& e)
|
||||||
|
{
|
||||||
|
m_nWidth = e.m_size.x;
|
||||||
|
m_nHeight = e.m_size.y;
|
||||||
|
|
||||||
|
m_nRows = m_nCols = 0;
|
||||||
|
if (m_nItems > 0 && m_nWidth >= 32 && m_nHeight >= 32)
|
||||||
|
{
|
||||||
|
int nSide = int(sqrt(double(m_nWidth * m_nHeight) / m_nItems));
|
||||||
|
for ( ; nSide > 32 && m_nRows*m_nCols < m_nItems; nSide--)
|
||||||
|
{
|
||||||
|
m_nRows = m_nHeight / nSide;
|
||||||
|
m_nCols = m_nWidth / nSide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wxRect TwxMetroBar::GetRect(int i) const
|
||||||
|
{
|
||||||
|
wxCoord x0=0, y0=0, x1=0, y1=0;
|
||||||
|
if (i >= 0 && i < m_nItems && m_nCols > 0)
|
||||||
|
{
|
||||||
|
const int r = i / m_nCols;
|
||||||
|
const int c = i % m_nCols;
|
||||||
|
|
||||||
|
x0 = c * m_nWidth / m_nCols;
|
||||||
|
y0 = r * m_nHeight / m_nRows;
|
||||||
|
x1 = (i == m_nItems-1)||(c%m_nCols==m_nCols-1) ? m_nWidth : (c+1) * m_nWidth / m_nCols;
|
||||||
|
y1 = r == m_nRows-1 ? m_nHeight : (r+1) * m_nHeight / m_nRows;
|
||||||
|
}
|
||||||
|
return wxRect(x0, y0, x1-x0, y1-y0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwxMetroBar::DrawCell(wxDC& dc, int i) const
|
||||||
|
{
|
||||||
|
const bool bSelected = (i == m_nHover) || (i == m_nCurr);
|
||||||
|
|
||||||
|
dc.SetFont(GetFont()); // Imposta il font predefinito per questo controllo
|
||||||
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
|
|
||||||
|
wxRect rct = GetRect(i);
|
||||||
|
dc.SetBrush(bSelected ? m_rgbSelectFore : m_rgbBorder);
|
||||||
|
dc.DrawRectangle(rct);
|
||||||
|
rct.Deflate(2, 2);
|
||||||
|
dc.SetBrush(GetBackgroundColour());
|
||||||
|
dc.DrawRectangle(rct);
|
||||||
|
|
||||||
|
const TwxOutlookItem& oi = m_item[i];
|
||||||
|
|
||||||
|
int nIco = 0;
|
||||||
|
if (oi.m_nIconId > 0 && rct.height > 32)
|
||||||
|
{
|
||||||
|
nIco = RoundToIcon(rct.height/2);
|
||||||
|
const wxIcon ico = xvtart_GetIconResource(oi.m_nIconId, wxART_TOOLBAR, nIco);
|
||||||
|
if (ico.IsOk())
|
||||||
|
{
|
||||||
|
const wxSize szIco(ico.GetWidth(), ico.GetHeight());
|
||||||
|
dc.DrawIcon(ico, rct.x + (rct.width-szIco.x)/2, rct.y+2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
nIco = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString s = oi.m_strText;
|
||||||
|
const wxRect rctText(rct.x+2, rct.y + nIco, rct.width-4, rct.height - nIco-2);
|
||||||
|
const wxSize sz = dc.GetTextExtent(oi.m_strText);
|
||||||
|
if (sz.x > rctText.width)
|
||||||
|
{
|
||||||
|
if (sz.x > 3*rctText.width/2)
|
||||||
|
{
|
||||||
|
int nSplit1 = s.rfind(' ', s.Length()/3+1);
|
||||||
|
if (nSplit1 < 0)
|
||||||
|
nSplit1 = s.find(' ');
|
||||||
|
if (nSplit1 > 0)
|
||||||
|
s[nSplit1] = '\n';
|
||||||
|
int nSplit2 = s.find(' ', 2*s.Length()/3-1);
|
||||||
|
if (nSplit2 < 0)
|
||||||
|
nSplit2 = s.rfind(' ');
|
||||||
|
if (nSplit2 > nSplit1)
|
||||||
|
s[nSplit2] = '\n';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const int l2 = s.Length()/2;
|
||||||
|
int nSplit = s.rfind(' ', l2);
|
||||||
|
if (nSplit < 0)
|
||||||
|
{
|
||||||
|
nSplit = s.find(' ', l2);
|
||||||
|
if (nSplit < 0)
|
||||||
|
s.insert(l2, "\n");
|
||||||
|
}
|
||||||
|
if (nSplit > 0)
|
||||||
|
s[nSplit] = '\n';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dc.DrawLabel(s, rctText, wxALIGN_BOTTOM);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwxMetroBar::OnPaint(wxPaintEvent& evt)
|
||||||
|
{
|
||||||
|
wxPaintDC dc(this);
|
||||||
|
dc.SetBackground(wxBrush(m_rgbBorder));
|
||||||
|
dc.Clear();
|
||||||
|
|
||||||
|
if (m_nItems > 0)
|
||||||
|
{
|
||||||
|
if (m_nItems != m_nRows*m_nCols)
|
||||||
|
{
|
||||||
|
wxSizeEvent e;
|
||||||
|
e.m_size = GetClientRect().GetSize();
|
||||||
|
OnResize(e);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < m_nItems; i++)
|
||||||
|
DrawCell(dc, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int TwxMetroBar::HitTest(const wxPoint& pt) const
|
||||||
|
{
|
||||||
|
int i = wxNOT_FOUND;
|
||||||
|
for (i = m_nItems-1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
const wxRect r = GetRect(i);
|
||||||
|
if (r.Contains(pt))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwxMetroBar::OnMouseMove(wxMouseEvent& evt)
|
||||||
|
{
|
||||||
|
const int nWasHovering = m_nHover;
|
||||||
|
m_nHover = HitTest(evt.GetPosition());
|
||||||
|
if (m_nHover != nWasHovering)
|
||||||
|
{
|
||||||
|
wxClientDC dc(this);
|
||||||
|
if (nWasHovering != wxNOT_FOUND)
|
||||||
|
DrawCell(dc, nWasHovering);
|
||||||
|
if (m_nHover != wxNOT_FOUND)
|
||||||
|
DrawCell(dc, m_nHover);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwxMetroBar::OnMouseLeave(wxMouseEvent& WXUNUSED(e))
|
||||||
|
{
|
||||||
|
if (m_nHover != wxNOT_FOUND)
|
||||||
|
{
|
||||||
|
wxClientDC dc(this);
|
||||||
|
const int nWasHovering = m_nHover;
|
||||||
|
m_nHover = wxNOT_FOUND;
|
||||||
|
DrawCell(dc, nWasHovering);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwxMetroBar::OnMouseDown(wxMouseEvent& e)
|
||||||
|
{
|
||||||
|
const int ht = HitTest(e.GetPosition());
|
||||||
|
if (ht != m_nCurr)
|
||||||
|
{
|
||||||
|
const int nPrev = m_nCurr;
|
||||||
|
m_nCurr = ht;
|
||||||
|
if (nPrev != wxNOT_FOUND)
|
||||||
|
{
|
||||||
|
wxClientDC dc(this);
|
||||||
|
DrawCell(dc, nPrev);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_nCurr >= 0 && m_nCurr < m_nItems )
|
||||||
|
{
|
||||||
|
TwxWindow* win = wxDynamicCast(GetParent(), TwxWindow);
|
||||||
|
if (win != NULL)
|
||||||
|
{
|
||||||
|
XVT_EVENT e(E_CONTROL);
|
||||||
|
e.v.ctl.id = GetId();
|
||||||
|
e.v.ctl.ci.type = WC_METROBAR;
|
||||||
|
e.v.ctl.ci.win = WINDOW(this);
|
||||||
|
win->DoXvtEvent(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int TwxMetroBar::Add(short nIconId, const wxString strText, int nFlags)
|
||||||
|
{
|
||||||
|
if (m_nItems < MAX_ITEMS)
|
||||||
|
{
|
||||||
|
TwxOutlookItem& oi = m_item[m_nItems++];
|
||||||
|
oi.m_nFlags = nFlags;
|
||||||
|
oi.m_nIconId = nIconId;
|
||||||
|
oi.m_strText = strText;
|
||||||
|
}
|
||||||
|
return m_nItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
TwxMetroBar::TwxMetroBar(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
|
: wxWindow(parent, id, pos, size, style), m_nItems(0), m_nCurr(wxNOT_FOUND), m_nHover(wxNOT_FOUND),
|
||||||
|
m_rgbBorder(0x80,0x80,0x80), m_rgbSelectFore(*wxLIGHT_GREY)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// TwxPopUp
|
// TwxPopUp
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -1885,8 +2210,7 @@ void TwxPopUp::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t u) const
|
|||||||
const int n = u; // Anti warning
|
const int n = u; // Anti warning
|
||||||
if (n == m_nHovering || (m_nHovering == wxNOT_FOUND && IsCurrent(u)))
|
if (n == m_nHovering || (m_nHovering == wxNOT_FOUND && IsCurrent(u)))
|
||||||
{
|
{
|
||||||
wxBrush brush(m_clrBack);
|
dc.SetBrush(m_clrBack);
|
||||||
dc.SetBrush(brush);
|
|
||||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
dc.DrawRectangle(rect);
|
dc.DrawRectangle(rect);
|
||||||
}
|
}
|
||||||
@ -2127,6 +2451,7 @@ class TwxToolBar : public TwxToolBarBase
|
|||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(TwxToolBar)
|
DECLARE_DYNAMIC_CLASS(TwxToolBar)
|
||||||
wxBitmap m_texture;
|
wxBitmap m_texture;
|
||||||
|
bool m_bMetroStyle;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
@ -2140,8 +2465,9 @@ protected:
|
|||||||
public:
|
public:
|
||||||
void ShowTool(int id, bool on);
|
void ShowTool(int id, bool on);
|
||||||
void SetBackgroundTexture(XVT_IMAGE img);
|
void SetBackgroundTexture(XVT_IMAGE img);
|
||||||
TwxToolBar(wxWindow* parent, wxWindowID id, const wxPoint& pos,
|
void SetMetroStyle(bool ms);
|
||||||
const wxSize& size, long style);
|
|
||||||
|
TwxToolBar(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style);
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(TwxToolBar, TwxToolBarBase)
|
IMPLEMENT_DYNAMIC_CLASS(TwxToolBar, TwxToolBarBase)
|
||||||
@ -2174,13 +2500,19 @@ void TwxToolBar::OnEraseBackground(wxEraseEvent& evt)
|
|||||||
dc.DrawBitmap(m_texture, x, y);
|
dc.DrawBitmap(m_texture, x, y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (m_bMetroStyle)
|
||||||
|
{
|
||||||
|
evt.Skip();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
const wxColour b0 = GetBackgroundColour();
|
const wxColour b0 = GetBackgroundColour();
|
||||||
const wxColour b1 = ModulateColour(b0, -10);
|
const wxColour b1 = ModulateColour(b0, -10);
|
||||||
const wxColour b2 = ModulateColour(b0, +70);
|
const wxColour b2 = ModulateColour(b0, +70);
|
||||||
wxCoord cw, ch; dc.GetSize(&cw, &ch);
|
wxCoord cw, ch; dc.GetSize(&cw, &ch);
|
||||||
#if wxCHECK_VERSION(2,8,12)
|
#if wxCHECK_VERSION(2,8,12)
|
||||||
// Nuovo modo: effetto acqua in stile TwxOutlookBar
|
// Nuovo modo: effetto acqua in stile Outlook
|
||||||
const wxColour b3 = ModulateColour(b1, +20);
|
const wxColour b3 = ModulateColour(b1, +20);
|
||||||
const int delta = 2*ch/5;
|
const int delta = 2*ch/5;
|
||||||
wxRect r1(0,0,cw,ch), r2(0,0,cw,ch);
|
wxRect r1(0,0,cw,ch), r2(0,0,cw,ch);
|
||||||
@ -2193,6 +2525,7 @@ void TwxToolBar::OnEraseBackground(wxEraseEvent& evt)
|
|||||||
dc.GradientFillLinear(wxRect(0,0,cw,ch),b1,b2,wxSOUTH);
|
dc.GradientFillLinear(wxRect(0,0,cw,ch),b1,b2,wxSOUTH);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TwxToolBar::SetBackgroundColour(const wxColour& colour)
|
bool TwxToolBar::SetBackgroundColour(const wxColour& colour)
|
||||||
@ -2219,7 +2552,6 @@ bool TwxToolBar::SetForegroundColour(const wxColour& colour)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TwxToolBar::SetBackgroundTexture(XVT_IMAGE xvt_img)
|
void TwxToolBar::SetBackgroundTexture(XVT_IMAGE xvt_img)
|
||||||
{
|
{
|
||||||
if (xvt_img != NULL)
|
if (xvt_img != NULL)
|
||||||
@ -2230,13 +2562,17 @@ void TwxToolBar::SetBackgroundTexture(XVT_IMAGE xvt_img)
|
|||||||
SetBackgroundColour(mean);
|
SetBackgroundColour(mean);
|
||||||
|
|
||||||
m_texture = wxBitmap(img);
|
m_texture = wxBitmap(img);
|
||||||
|
m_bMetroStyle = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_texture = wxNullBitmap;
|
m_texture = wxNullBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TwxToolBar::SetMetroStyle(bool ms)
|
||||||
|
{ m_bMetroStyle = ms; }
|
||||||
|
|
||||||
TwxToolBar::TwxToolBar(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
TwxToolBar::TwxToolBar(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
: TwxToolBarBase(parent, id, pos, size, style)
|
: TwxToolBarBase(parent, id, pos, size, style), m_bMetroStyle(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
static TwxToolBar* Win2Bar(WINDOW win)
|
static TwxToolBar* Win2Bar(WINDOW win)
|
||||||
@ -2361,6 +2697,7 @@ WINDOW xvt_toolbar_create(int cid, int left, int top, int right, int bottom, lon
|
|||||||
wxWindow* pParent = wxStaticCast((wxObject*)parent, wxWindow);
|
wxWindow* pParent = wxStaticCast((wxObject*)parent, wxWindow);
|
||||||
TwxToolBar* tb = new TwxToolBar(pParent, cid, ptPos, wxDefaultSize, nStyle);
|
TwxToolBar* tb = new TwxToolBar(pParent, cid, ptPos, wxDefaultSize, nStyle);
|
||||||
tb->SetToolBitmapSize(wxSize(nIcoSize, nIcoSize));
|
tb->SetToolBitmapSize(wxSize(nIcoSize, nIcoSize));
|
||||||
|
tb->SetMetroStyle((nFlags & WSF_NO_TASKBAR) != 0);
|
||||||
|
|
||||||
return (WINDOW)tb;
|
return (WINDOW)tb;
|
||||||
}
|
}
|
||||||
@ -2437,6 +2774,26 @@ void xvt_toolbar_show_control(WINDOW win, int cid, BOOLEAN on)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOLEAN xvt_toolbar_remove_control(WINDOW win, int cid)
|
||||||
|
{
|
||||||
|
BOOLEAN ok = FALSE;
|
||||||
|
TwxToolBar* ptb = Win2Bar(win);
|
||||||
|
if (ptb != NULL)
|
||||||
|
{
|
||||||
|
TwxToolBar& tb = *ptb;
|
||||||
|
#ifdef wxAuiToolBar
|
||||||
|
tb.AddSeparator();
|
||||||
|
ok = idx < 0;
|
||||||
|
#else
|
||||||
|
wxToolBarToolBase* tool = tb.RemoveTool(cid);
|
||||||
|
ok = tool != NULL;
|
||||||
|
if (ok) delete tool;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void xvt_dwin_draw_tool(WINDOW win, int x, int y, int rid, int size)
|
void xvt_dwin_draw_tool(WINDOW win, int x, int y, int rid, int size)
|
||||||
{
|
{
|
||||||
const wxBitmap bmp = xvtart_GetToolResource(rid, size);
|
const wxBitmap bmp = xvtart_GetToolResource(rid, size);
|
||||||
@ -3288,7 +3645,7 @@ BOOLEAN xvt_html_set_url(WINDOW win, const char* url)
|
|||||||
wxHtmlWindow* w = win ? wxDynamicCast((wxObject*)win, wxHtmlWindow) : NULL;
|
wxHtmlWindow* w = win ? wxDynamicCast((wxObject*)win, wxHtmlWindow) : NULL;
|
||||||
if (w)
|
if (w)
|
||||||
{
|
{
|
||||||
wxString strLocation = url;
|
const wxString strLocation = url;
|
||||||
if (strLocation.IsEmpty() || strLocation.StartsWith("<"))
|
if (strLocation.IsEmpty() || strLocation.StartsWith("<"))
|
||||||
done = w->SetPage(strLocation);
|
done = w->SetPage(strLocation);
|
||||||
else
|
else
|
||||||
@ -3330,6 +3687,9 @@ WIN_TYPE xvt_vobj_get_type(WINDOW win)
|
|||||||
const wxPropertyGrid* pg = wxDynamicCast((wxObject*)win, wxPropertyGrid);
|
const wxPropertyGrid* pg = wxDynamicCast((wxObject*)win, wxPropertyGrid);
|
||||||
if (pg != NULL)
|
if (pg != NULL)
|
||||||
return WC_PROPGRID;
|
return WC_PROPGRID;
|
||||||
|
const TwxMetroBar* mb = wxDynamicCast((wxObject*)win, TwxMetroBar);
|
||||||
|
if (mb != NULL)
|
||||||
|
return WC_METROBAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return WO_TE; // Unknown custom control
|
return WO_TE; // Unknown custom control
|
||||||
|
Loading…
x
Reference in New Issue
Block a user