Removed the ability to save screenshots as bitmaps. The BMP format is dead.
This commit is contained in:
bgk 2008-06-05 08:25:35 +00:00
parent 20def2fca2
commit cfc3875d18
4 changed files with 7 additions and 119 deletions

View File

@ -917,38 +917,6 @@
<property name="use_underline">True</property> <property name="use_underline">True</property>
</widget> </widget>
</child> </child>
<child>
<widget class="GtkSeparatorMenuItem" id="separator30">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="ScreenshotFormatMenu">
<property name="visible">True</property>
<property name="label" translatable="yes">Screenshot format</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="ScreenshotFormatMenu_menu">
<child>
<widget class="GtkRadioMenuItem" id="ScreenshotFormatPNG">
<property name="visible">True</property>
<property name="label" translatable="yes">_PNG</property>
<property name="use_underline">True</property>
<property name="active">True</property>
</widget>
</child>
<child>
<widget class="GtkRadioMenuItem" id="ScreenshotFormatBMP">
<property name="visible">True</property>
<property name="label" translatable="yes">_BMP</property>
<property name="use_underline">True</property>
<property name="group">ScreenshotFormatPNG</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget> </widget>
</child> </child>
</widget> </widget>

View File

@ -504,32 +504,6 @@ Window::Window(GtkWindow * _pstWindow, const Glib::RefPtr<Xml> & _poXml) :
poCMI, astFlashSize[i].m_iFlashSize)); poCMI, astFlashSize[i].m_iFlashSize));
} }
// Screenshot format menu
//
struct
{
const char * m_csName;
const char * m_csScreenshotFormat;
}
astScreenshotFormat[] =
{
{ "ScreenshotFormatPNG", "png" },
{ "ScreenshotFormatBMP", "bmp" }
};
std::string sDefaultScreenshotFormat = m_poCoreConfig->sGetKey("screenshot_format");
for (guint i = 0; i < G_N_ELEMENTS(astScreenshotFormat); i++)
{
poCMI = dynamic_cast<Gtk::CheckMenuItem *>(_poXml->get_widget(astScreenshotFormat[i].m_csName));
if (astScreenshotFormat[i].m_csScreenshotFormat == sDefaultScreenshotFormat)
{
poCMI->set_active();
vOnScreenshotFormatToggled(poCMI, sDefaultScreenshotFormat);
}
poCMI->signal_toggled().connect(sigc::bind(
sigc::mem_fun(*this, &Window::vOnScreenshotFormatToggled),
poCMI, std::string(astScreenshotFormat[i].m_csScreenshotFormat)));
}
// Sound menu // Sound menu
// //
std::string sDefaultSoundStatus = m_poSoundConfig->sGetKey("status"); std::string sDefaultSoundStatus = m_poSoundConfig->sGetKey("status");
@ -1034,7 +1008,6 @@ void Window::vInitConfig()
m_poCoreConfig->vSetKey("gb_border", true ); m_poCoreConfig->vSetKey("gb_border", true );
m_poCoreConfig->vSetKey("gb_printer", false ); m_poCoreConfig->vSetKey("gb_printer", false );
m_poCoreConfig->vSetKey("emulator_type", EmulatorAuto ); m_poCoreConfig->vSetKey("emulator_type", EmulatorAuto );
m_poCoreConfig->vSetKey("screenshot_format", "png" );
// Display section // Display section
// //
@ -1186,12 +1159,6 @@ void Window::vCheckConfig()
m_poCoreConfig->vSetKey("emulator_type", iAdjusted); m_poCoreConfig->vSetKey("emulator_type", iAdjusted);
} }
sValue = m_poCoreConfig->sGetKey("screenshot_format");
if (sValue != "png" && sValue != "bmp")
{
sValue = "png";
}
// Display section // Display section
// //
iValue = m_poDisplayConfig->oGetKey<int>("scale"); iValue = m_poDisplayConfig->oGetKey<int>("scale");
@ -1702,20 +1669,13 @@ void Window::vCaptureScreen(int _iNum)
{ {
sBaseName = sCaptureDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile)); sBaseName = sCaptureDir + "/" + sCutSuffix(Glib::path_get_basename(m_sRomFile));
} }
std::string sFormat = m_poCoreConfig->sGetKey("screenshot_format");
char * csFile = g_strdup_printf("%s_%02d.%s", char * csFile = g_strdup_printf("%s_%02d.png",
sBaseName.c_str(), sBaseName.c_str(),
_iNum, _iNum);
sFormat.c_str());
if (sFormat == "png") m_stEmulator.emuWritePNG(csFile);
{
m_stEmulator.emuWritePNG(csFile);
}
else
{
m_stEmulator.emuWriteBMP(csFile);
}
g_free(csFile); g_free(csFile);
} }

View File

@ -172,7 +172,6 @@ protected:
virtual void vOnShowSpeedToggled(Gtk::CheckMenuItem * _poCMI, int _iShowSpeed); virtual void vOnShowSpeedToggled(Gtk::CheckMenuItem * _poCMI, int _iShowSpeed);
virtual void vOnSaveTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iSaveType); virtual void vOnSaveTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iSaveType);
virtual void vOnFlashSizeToggled(Gtk::CheckMenuItem * _poCMI, int _iFlashSize); virtual void vOnFlashSizeToggled(Gtk::CheckMenuItem * _poCMI, int _iFlashSize);
virtual void vOnScreenshotFormatToggled(Gtk::CheckMenuItem * _poCMI, std::string _sFormat);
virtual void vOnSoundStatusToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundStatus); virtual void vOnSoundStatusToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundStatus);
virtual void vOnSoundEchoToggled(Gtk::CheckMenuItem * _poCMI); virtual void vOnSoundEchoToggled(Gtk::CheckMenuItem * _poCMI);
virtual void vOnSoundLowPassToggled(Gtk::CheckMenuItem * _poCMI); virtual void vOnSoundLowPassToggled(Gtk::CheckMenuItem * _poCMI);

View File

@ -426,31 +426,12 @@ void Window::vOnFileScreenCapture()
oPngFilter.set_name(_("PNG image")); oPngFilter.set_name(_("PNG image"));
oPngFilter.add_pattern("*.[pP][nN][gG]"); oPngFilter.add_pattern("*.[pP][nN][gG]");
Gtk::FileFilter oBmpFilter;
oBmpFilter.set_name(_("BMP image"));
oBmpFilter.add_pattern("*.[bB][mM][pP]");
oDialog.add_filter(oPngFilter); oDialog.add_filter(oPngFilter);
oDialog.add_filter(oBmpFilter);
if (m_poCoreConfig->sGetKey("screenshot_format") == "bmp")
{
oDialog.set_filter(oBmpFilter);
}
while (oDialog.run() == Gtk::RESPONSE_OK) while (oDialog.run() == Gtk::RESPONSE_OK)
{ {
Glib::ustring sFile = oDialog.get_filename(); Glib::ustring sFile = oDialog.get_filename();
Glib::ustring sExt; Glib::ustring sExt = ".png";
if (oDialog.get_filter() == &oPngFilter)
{
sExt = ".png";
}
else
{
sExt = ".bmp";
}
if (! bHasSuffix(sFile, sExt, false)) if (! bHasSuffix(sFile, sExt, false))
{ {
@ -470,17 +451,7 @@ void Window::vOnFileScreenCapture()
} }
} }
bool bResult; if (m_stEmulator.emuWritePNG(sFile.c_str()))
if (sExt == ".png")
{
bResult = m_stEmulator.emuWritePNG(sFile.c_str());
}
else
{
bResult = m_stEmulator.emuWriteBMP(sFile.c_str());
}
if (bResult)
{ {
break; break;
} }
@ -827,16 +798,6 @@ void Window::vOnFlashSizeToggled(Gtk::CheckMenuItem * _poCMI, int _iFlashSize)
m_poCoreConfig->vSetKey("flash_size", _iFlashSize); m_poCoreConfig->vSetKey("flash_size", _iFlashSize);
} }
void Window::vOnScreenshotFormatToggled(Gtk::CheckMenuItem * _poCMI, std::string _sFormat)
{
if (! _poCMI->get_active())
{
return;
}
m_poCoreConfig->vSetKey("screenshot_format", _sFormat);
}
void Window::vOnSoundStatusToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundStatus) void Window::vOnSoundStatusToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundStatus)
{ {
if (! _poCMI->get_active()) if (! _poCMI->get_active())