return extension when no detected contents.

Herbert

-- 
http://www.lyx.org/help/
Index: src/frontends/controllers/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v
retrieving revision 1.136
diff -u -r1.136 ChangeLog
--- src/frontends/controllers/ChangeLog 2002/02/18 19:13:46     1.136
+++ src/frontends/controllers/ChangeLog 2002/02/18 21:26:33
@@ -1,3 +1,7 @@
+2002-02-18  Herbert Voss  <[EMAIL PROTECTED]>
+
+       * ControlGraphics.[C]: remove help-file call
+
 2002-02-18  Angus Leeming  <[EMAIL PROTECTED]>
 
        * helper_funcs.h: wrap the structs firster and seconder up in a
Index: src/frontends/controllers/ControlGraphics.C
===================================================================
RCS file: 
/usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlGraphics.C,v
retrieving revision 1.20
diff -u -r1.20 ControlGraphics.C
--- src/frontends/controllers/ControlGraphics.C 2002/02/16 12:39:46     1.20
+++ src/frontends/controllers/ControlGraphics.C 2002/02/18 21:26:33
@@ -131,8 +131,4 @@
        return string();
 }
 
-void ControlGraphics::help() const
-{
-       lv_.getDialogs()->showFile(i18nLibFileSearch("help","Graphics.hlp"));
-}
 
Index: src/frontends/controllers/ControlGraphics.h
===================================================================
RCS file: 
/usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlGraphics.h,v
retrieving revision 1.5
diff -u -r1.5 ControlGraphics.h
--- src/frontends/controllers/ControlGraphics.h 2002/01/29 09:26:23     1.5
+++ src/frontends/controllers/ControlGraphics.h 2002/02/18 21:26:33
@@ -40,8 +40,6 @@
        string const readBB(string const & file);
        /// Control the bb
        bool bbChanged;
-       /// Show Help file
-       void help() const;
 
 private:
        /// Dispatch the changed parameters to the kernel.
Index: src/frontends/xforms/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/ChangeLog,v
retrieving revision 1.294
diff -u -r1.294 ChangeLog
--- src/frontends/xforms/ChangeLog      2002/02/18 19:13:46     1.294
+++ src/frontends/xforms/ChangeLog      2002/02/18 21:26:34
@@ -1,3 +1,7 @@
+2002-02-18  Herbert Voss  <[EMAIL PROTECTED]>
+
+       * FormGraphics.C: same units for LyX and Latex view, cosmetics
+
 2002-02-18  Angus Leeming  <[EMAIL PROTECTED]>
 
        * Timeout_pimpl.[Ch] (running): new method.
Index: src/frontends/xforms/FormGraphics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/xforms/FormGraphics.C,v
retrieving revision 1.49
diff -u -r1.49 FormGraphics.C
--- src/frontends/xforms/FormGraphics.C 2002/02/16 15:59:49     1.49
+++ src/frontends/xforms/FormGraphics.C 2002/02/18 21:26:35
@@ -106,8 +106,8 @@
        fl_set_input_return (lyxview_->input_lyxheight, FL_RETURN_CHANGED);
        fl_set_input_return (lyxview_->input_lyxscale, FL_RETURN_CHANGED);
 
-       fl_addto_choice(lyxview_->choice_width_lyxwidth, 
choice_Length_WithUnit.c_str());
-       fl_addto_choice(lyxview_->choice_width_lyxheight, 
choice_Length_WithUnit.c_str());
+       fl_addto_choice(lyxview_->choice_width_lyxwidth, choice_Length_All.c_str());
+       fl_addto_choice(lyxview_->choice_width_lyxheight, choice_Length_All.c_str());
 
        bc().addReadOnly(lyxview_->radio_pref);
        bc().addReadOnly(lyxview_->radio_mono);
@@ -385,9 +385,10 @@
        // path, because the controller knows nothing about the doc-dir
        controller().bbChanged = false;
        if (igp.bb.empty()) {
-           string const fileWithAbsPath =
+       lyxerr[Debug::GRAPHICS] << "update:: no BoundingBox" << endl;
+           string const fileWithAbsPath = 
                MakeAbsPath(igp.filename, OnlyPath(igp.filename));      
-           string const bb = controller().readBB(fileWithAbsPath);
+           string const bb = controller().readBB(fileWithAbsPath);         
            if (!bb.empty()) {          
                // get the values from the file
                // in this case we always have the point-unit
@@ -401,9 +402,9 @@
                    fl_set_input(bbox_->input_bb_x1, bb.c_str());
                    fl_set_input(bbox_->input_bb_y1, bb.c_str());
            }
-           string const unit("pt");
-           fl_set_choice_text(bbox_->choice_bb_units, unit.c_str());
+           fl_set_choice(bbox_->choice_bb_units, 1);   // "pt"
        } else {                                // get the values from the inset
+           lyxerr[Debug::GRAPHICS] << "update:: igp has BoundingBox" << endl;
            controller().bbChanged = true;
            LyXLength anyLength;
            anyLength = LyXLength(token(igp.bb,' ',0));
Index: src/insets/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.315
diff -u -r1.315 ChangeLog
--- src/insets/ChangeLog        2002/02/18 19:13:47     1.315
+++ src/insets/ChangeLog        2002/02/18 21:26:36
@@ -1,3 +1,7 @@
+2002-02-18  Herbert Voss  <[EMAIL PROTECTED]>
+
+       * insetgraphics.C: use [Debug::GRAPHICS] for lyxerr
+
 2002-02-18  Angus Leeming  <[EMAIL PROTECTED]>
 
        * insetexternal.C Changes due to the renaming of support/syscall.[Ch]
Index: src/insets/insetgraphics.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.82
diff -u -r1.82 insetgraphics.C
--- src/insets/insetgraphics.C  2002/02/16 15:59:52     1.82
+++ src/insets/insetgraphics.C  2002/02/18 21:26:36
@@ -333,7 +333,7 @@
        else if (token == "Figure") // Compatibility reading of FigInset figures.
                readFigInset(buf, lex);
        else
-               lyxerr[Debug::INFO] << "Not a Graphics or Figure inset!\n";
+               lyxerr[Debug::GRAPHICS] << "Not a Graphics or Figure inset!\n";
 
        updateInset();
 }
@@ -346,7 +346,7 @@
                lex.next();
 
                string const token = lex.getString();
-               lyxerr[Debug::INFO] << "Token: '" << token << '\'' 
+               lyxerr[Debug::GRAPHICS] << "Token: '" << token << '\'' 
                                    << endl;
 
                if (token.empty()) {
@@ -391,7 +391,7 @@
                lex.next();
 
                string const token = lex.getString();
-               lyxerr[Debug::INFO] << "Token: " << token << endl;
+               lyxerr[Debug::GRAPHICS] << "Token: " << token << endl;
                
                if (token.empty())
                        continue;
@@ -509,7 +509,7 @@
        // lyxrc.pdf_mode means:
        // Are we creating a PDF or a PS file?
        // (Should actually mean, are we using latex or pdflatex).      
-       lyxerr[Debug::INFO] << "decideOutput::lyxrc.pdf_mode = " << lyxrc.pdf_mode << 
"\n";
+       lyxerr[Debug::GRAPHICS] << "decideOutput::lyxrc.pdf_mode = " << lyxrc.pdf_mode 
+<< "\n";
        if (lyxrc.pdf_mode) {
                if (contains(suffix,"ps") || suffix == "pdf")
                        return "pdf";
@@ -519,7 +519,7 @@
                        return "png";
        }
        // If it's postscript, we always do eps.
-       lyxerr[Debug::INFO] << "decideOutput: we have PostScript mode\n";
+       lyxerr[Debug::GRAPHICS] << "decideOutput: we have PostScript mode\n";
        if (suffix != "ps")
            return "eps";
        else
@@ -544,7 +544,7 @@
        //
        // if it's a zipped one, than let LaTeX do the rest!!!
        if ((zippedFile(params.filename) && params.noUnzip) || buf->niceFile) {
-           lyxerr[Debug::INFO] << "don't unzip file or export latex" 
+           lyxerr[Debug::GRAPHICS] << "don't unzip file or export latex" 
                    << params.filename << endl;
            return params.filename;
        }
@@ -569,10 +569,10 @@
        string outfile;
        string const temp = AddName(buf->tmppath, filename_);
        outfile = RemoveExtension(temp);
-       lyxerr[Debug::INFO] << "tempname = " << temp << "\n";
-       lyxerr[Debug::INFO] << "buf::tmppath = " << buf->tmppath << "\n";
-       lyxerr[Debug::INFO] << "filename_ = " << filename_ << "\n";
-       lyxerr[Debug::INFO] << "outfile = " << outfile << endl;
+       lyxerr[Debug::GRAPHICS] << "tempname = " << temp << "\n";
+       lyxerr[Debug::GRAPHICS] << "buf::tmppath = " << buf->tmppath << "\n";
+       lyxerr[Debug::GRAPHICS] << "filename_ = " << filename_ << "\n";
+       lyxerr[Debug::GRAPHICS] << "outfile = " << outfile << endl;
        converters.convert(buf, filename_, outfile, extension, image_target);
        return outfile;
 }
Index: src/support/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/ChangeLog,v
retrieving revision 1.73
diff -u -r1.73 ChangeLog
--- src/support/ChangeLog       2002/02/18 19:13:47     1.73
+++ src/support/ChangeLog       2002/02/18 21:26:36
@@ -1,3 +1,8 @@
+2002-02-18  Herbert Voss  <[EMAIL PROTECTED]>
+
+       * filetools.C: (getExtFromContents) return the fileextension
+       if no format is detected.
+       
 2002-02-18  Angus Leeming  <[EMAIL PROTECTED]>
 
        * syscall.[Ch]: renamed as systemcall.[Ch]. class Systemcalls renamed
Index: src/support/filetools.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/filetools.C,v
retrieving revision 1.104
diff -u -r1.104 filetools.C
--- src/support/filetools.C     2002/02/18 19:13:48     1.104
+++ src/support/filetools.C     2002/02/18 21:26:37
@@ -980,7 +980,10 @@
 // GZIP        \037\213\010\010...     http://www.ietf.org/rfc/rfc1952.txt
 // ZIP PK...                   http://www.halyava.ru/document/ind_arch.htm
 // Z   \037\177                UNIX compress
+
 /// return the "extension" which belongs to the contents
+/// for no knowing contents return the extension. Without
+/// an extension and unknown contents we return "user"
 string const getExtFromContents(string const & filename) {
        if (filename.empty() || !IsFileReadable(filename)) 
            return string();    // paranoia check
@@ -996,7 +999,7 @@
        bool zipChecked = false;
        for (; count < max_count; ++count) {
                if (ifs.eof()) {
-                       lyxerr[Debug::INFO] << "filetools(getExtFromContents)"
+                       lyxerr[Debug::GRAPHICS] << "filetools(getExtFromContents)"
                                " End of file reached and it wasn't found to be a 
known Type!" << endl;
                        break;
                }
@@ -1027,7 +1030,6 @@
                else if (contains(str,"PNG"))
                    return "png";
                else if (contains(str,"%!PS-Adobe")) { // eps or ps
-                   // test if it's ps or eps
                    ifs >> str;
                    if (contains(str,"EPSF"))
                        return "eps";
@@ -1038,9 +1040,12 @@
                else if (contains(str,"XPM"))
                    return "xpm";
        }
-       lyxerr[Debug::INFO] << "filetools(getExtFromContents)\n"
+       lyxerr[Debug::GRAPHICS] << "filetools(getExtFromContents)\n"
                "\tCouldn't find a known Type!" 
-               "\twill use a \"user\" defined format (based on file extension)" << 
endl;
+               "\twill use ext or a \"user\" defined format" << endl;
+       string const ext(GetExtension(filename));
+       if (!ext.empty())
+           return ext;
        return "user";
 }
 

Reply via email to