diff --git a/include/applicat.cpp b/include/applicat.cpp index 59e5fd3e2..493535c67 100755 --- a/include/applicat.cpp +++ b/include/applicat.cpp @@ -371,7 +371,6 @@ const char* TApplication::get_module_name() const TString module(scanner.token().mid(3)); if (ok) ok = has_module(aut); - if (!ok) { TToken_string em(extra_modules()); diff --git a/include/files.cpp b/include/files.cpp index 848a54f86..4accf988f 100755 --- a/include/files.cpp +++ b/include/files.cpp @@ -226,7 +226,7 @@ TRecnotype & TDir::eox () const return _dir->EOX; } -TRecnotype & TDir::flags () const +long& TDir::flags () const { return _dir->Flags; diff --git a/include/files.h b/include/files.h index d80990b7a..4b8f0bd40 100755 --- a/include/files.h +++ b/include/files.h @@ -134,7 +134,7 @@ public: // @cmember Ritorna l'EOX del file selezionato TRecnotype& eox() const; // @cmember Ritorna il flag del file selezionato - TRecnotype& flags() const; + long& flags() const; // @cmember Ritorna la lunghezza del tracciato record in bytes word& len() const; // @cmember Ritorna lo stato d'errore del file diff --git a/include/golem.cpp b/include/golem.cpp index a590c5dd6..3f25f1c9e 100755 --- a/include/golem.cpp +++ b/include/golem.cpp @@ -45,11 +45,12 @@ HIDDEN bool file2app(const char* filename, TString& app) if (!ok) { - char ext[_MAX_EXT]; + TString ext(_MAX_EXT); if (*filename == '.') - strncpy(ext, filename, _MAX_EXT); + ext = filename; else - _splitpath(filename, NULL, NULL, NULL, ext); + _splitpath(filename, NULL, NULL, NULL, ext.get_buffer()); + ext.lower(); TFilename key; if (get_reg_key(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS) @@ -109,37 +110,24 @@ HIDDEN word file2icon(const char* filename) if (ext != ".exe") { - // Prima controlla il mio registro delle applicazioni ... - TConfig link(CONFIG_USER, "Link"); - key = link.get(ext.mid(1, -1)); // Ignora il . - - if (key.not_empty()) - { - ext = key.ext(); - if (ext.empty()) - key.ext("exe"); - } - else // ... poi controlla il registro di Windows - { - if (get_reg_key(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS) - { - key << "\\DefaultIcon"; - if (get_reg_key(HKEY_CLASSES_ROOT, key, key) == ERROR_SUCCESS) // Windows 95 only + if (get_reg_key(HKEY_CLASSES_ROOT, ext, key) == ERROR_SUCCESS) + { + key << "\\DefaultIcon"; + if (get_reg_key(HKEY_CLASSES_ROOT, key, key) == ERROR_SUCCESS) // Windows 95 only + { + const int comma = key.find(','); + if (comma > 0) { - const int comma = key.find(','); - if (comma > 0) - { - icon_number = atoi(key.mid(comma+1)); - key.cut(comma); - } + icon_number = atoi(key.mid(comma+1)); + key.cut(comma); } - else - { - if (!file2app(filename, key)) - file2app(".htm", key); - } } - } + else + { + if (!file2app(filename, key)) + file2app(".htm", key); + } + } } else key = filename; @@ -159,18 +147,22 @@ HIDDEN word file2icon(const char* filename) return icon; } -HIDDEN bool goto_url(const char* url) +bool goto_url(const char* url) { TFilename app(url); - + app.lower(); + const TString ext(app.ext()); + TConfig link(CONFIG_USER, "Link"); - app = link.get(app.ext()); + app = link.get(ext); if (app.not_empty()) { app << ' ' << url; UINT error = WinExec(app, SW_SHOWNORMAL); if (error > 32) return TRUE; + else + link.set(ext, ""); } bool retflag = FALSE; @@ -195,7 +187,7 @@ HIDDEN bool goto_url(const char* url) } -HIDDEN bool print_url(const char* url) +bool print_url(const char* url) { HINSTANCE hinst = ShellExecute(NULL, "print", url, NULL, NULL, SW_SHOWNORMAL); DWORD winst = DWORD((DWORD*)hinst); @@ -423,7 +415,7 @@ void TGolem_field::set_window_data(const char* data) char* pipe = strchr(data, '|'); if (pipe) { - *pipe = '\0'; + *pipe = '\0'; // Poor man TToken_string icon = file2icon(data); *pipe = '|'; } @@ -476,7 +468,7 @@ bool TGolem_field::autosave(TRelation& r) TToken_string new_value(get(), '\n'); if (new_value != _old_value) { - TFilename golem_path(_MAX_PATH); + TFilename golem_path; TDir dir; dir.get(r.lfile().num()); const long ditta = dir.is_com() ? 0 : prefix().get_codditta(); golem_path = firm2dir(ditta); diff --git a/include/golem.h b/include/golem.h index 8f20e68c5..adf09cd60 100755 --- a/include/golem.h +++ b/include/golem.h @@ -5,6 +5,9 @@ #include #endif +bool goto_url(const char* url); +bool print_url(const char* url); + // @doc EXTERNAL // @class TDDE | Classe per la gestione del DDE diff --git a/include/viswin.cpp b/include/viswin.cpp index 4c1c99c5b..322962a32 100755 --- a/include/viswin.cpp +++ b/include/viswin.cpp @@ -5,7 +5,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -2214,49 +2215,34 @@ void TViswin::sel_to_clipboard() bool TViswin::call_editor() { - TConfig cnf (CONFIG_USER, "Link"); - const TFilename editor (cnf.get ("txt", NULL, -1, "notepad")); + TFilename newfilename; newfilename.tempdir(); + + FILE_SPEC fs; + xvt_fsys_convert_str_to_dir(newfilename.get_buffer(), &fs.dir); + strcpy (fs.type, "txt"); + strcpy (fs.name, "tmp"); + strcpy (fs.creator, "PRINT"); - bool ok = FALSE; - - if (!editor.empty ()) - { - TFilename newfilename; newfilename.tempdir(); - FILE_SPEC fs; - xvt_fsys_convert_str_to_dir((char*)(const char*)newfilename, &fs.dir); - strcpy (fs.type, "txt"); - strcpy (fs.name, ""); - - xvt_fsys_save_dir (); - ok = xvt_dm_post_file_save (&fs, "Salva il file con il nome:") == FL_OK; - xvt_fsys_restore_dir (); + xvt_fsys_save_dir (); + bool ok = xvt_dm_post_file_save (&fs, "Salva il file con il nome:") == FL_OK; + xvt_fsys_restore_dir (); - if (ok) + if (ok) + { + xvt_fsys_convert_dir_to_str (&fs.dir, newfilename.get_buffer(), newfilename.size()); + newfilename.add(fs.name); + + TPoint p1, p2; + if (_isselection) + adjust_selection (p1, p2); + + if (_txt.write (newfilename, _isselection ? &p1 : NULL, + _isselection ? &p2 : NULL)) { - char path[256]; - xvt_fsys_convert_dir_to_str (&fs.dir, path, sizeof (path)); - newfilename = path; - newfilename << '/' << fs.name; - - TPoint p1, p2; - if (_isselection) - adjust_selection (p1, p2); - - if (_txt.write (newfilename, _isselection ? &p1 : NULL, - _isselection ? &p2 : NULL)) - { - newfilename.insert (" ", 0); - newfilename.insert (editor, 0); - TExternal_app edit (newfilename); - if (edit.run(TRUE, FALSE)) - beep (); - else - ok = TRUE; - } + ok = goto_url(newfilename); } } - else - warning_box ("Nessun editor specificato nei parametri studio"); + return ok; }