From: K.Ohta Date: Sun, 8 Nov 2020 19:16:31 +0000 (+0900) Subject: [UI][Qt][DISPLAY] FLOPPY: Use 5inch icon using 5inch floppy. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=114e8bbc4d8f44758a90a0e62bf4ec0723b32a0e;p=csp-qt%2Fcommon_source_project-fm7.git [UI][Qt][DISPLAY] FLOPPY: Use 5inch icon using 5inch floppy. --- diff --git a/source/src/qt/gui/CMakeLists.txt b/source/src/qt/gui/CMakeLists.txt index 7fc221146..e8883eaef 100644 --- a/source/src/qt/gui/CMakeLists.txt +++ b/source/src/qt/gui/CMakeLists.txt @@ -1,6 +1,6 @@ message("* qt/gui") -set(THIS_LIB_VERSION 3.2.1) +set(THIS_LIB_VERSION 3.2.2) #include(cotire) #include(PrecompiledHeader) diff --git a/source/src/qt/gui/gl/qt_glutil_gl_tmpl.h b/source/src/qt/gui/gl/qt_glutil_gl_tmpl.h index 540ecb6bd..8977e8c0c 100644 --- a/source/src/qt/gui/gl/qt_glutil_gl_tmpl.h +++ b/source/src/qt/gui/gl/qt_glutil_gl_tmpl.h @@ -303,7 +303,7 @@ public: screen_texture_width_old = using_flags->get_screen_width(); screen_texture_height = using_flags->get_screen_height(); screen_texture_height_old = using_flags->get_screen_height(); - +#if 0 if(using_flags->is_use_fd()) { osd_led_bit_width = 10; } @@ -316,7 +316,15 @@ public: if(using_flags->get_max_scsi() > 0) { osd_led_bit_width = 24; } - + if(using_flags->is_use_compact_disc()) { + osd_led_bit_width = 26; + } + if(using_flags->is_use_laser_disc()) { + osd_led_bit_width = 28; + } +#else + osd_led_bit_width = 32; +#endif int i; // Will fix: Must fix setup of vm_buttons[]. button_desc_t *vm_buttons_d = using_flags->get_vm_buttons(); diff --git a/source/src/qt/gui/gl2/qt_glutil_gl2_0.cpp b/source/src/qt/gui/gl2/qt_glutil_gl2_0.cpp index c764d7791..d1f343e55 100644 --- a/source/src/qt/gui/gl2/qt_glutil_gl2_0.cpp +++ b/source/src/qt/gui/gl2/qt_glutil_gl2_0.cpp @@ -251,14 +251,21 @@ void GLDraw_2_0::drawOsdIcons() } else if((ii >= 14) && (ii < 16)) { // CMT(W) major = 5; minor = ii - 14; - } else if(ii >= 16) { - major = 4 + (ii / 8) - 2; - minor = ii % 8; + } else if((ii >= 16) && (ii < 24)) { // HDD + major = 8; + minor = ii - 16; + } else if((ii >= 24) && (ii < 26)) { // CD + major = 6; + minor = ii - 24; + } else if((ii >= 26) && (ii < 28)) { // LD + major = 7; + minor = ii - 26; } else { major = 0; minor = 0; } // ToDo: CD,LD and HDD. + if(icon_texid[major][minor] != NULL) { if(checkf) { drawMain(osd_shader, vertex_osd[ii], buffer_osd[ii], @@ -271,7 +278,8 @@ void GLDraw_2_0::drawOsdIcons() vertexOSD[ii], icon_texid[major][minor]->textureId(), color_off, false); - } + } + } _bit <<= 1; } osd_led_status_bak = osd_led_status; diff --git a/source/src/qt/gui/gl3/qt_glutil_gl3_0.cpp b/source/src/qt/gui/gl3/qt_glutil_gl3_0.cpp index 686bbc1ad..78ddc89cb 100644 --- a/source/src/qt/gui/gl3/qt_glutil_gl3_0.cpp +++ b/source/src/qt/gui/gl3/qt_glutil_gl3_0.cpp @@ -1213,16 +1213,27 @@ void GLDraw_3_0::drawOsdIcons() } else if((i >= 14) && (i < 16)) { // CMT(W) major = 5; minor = i - 14; + } else if((i >= 16) && (i < 24)) { // HDD + major = 8; + minor = i - 16; + } else if((i >= 24) && (i < 26)) { // CD + major = 6; + minor = i - 24; + } else if((i >= 26) && (i < 28)) { // LD + major = 7; + minor = i - 26; } else { major = 0; minor = 0; } // ToDo: CD(6),LD(7) and HDD(8). if((major != 0) && (icon_texid[major][minor] != NULL)) { - drawMain(osd_pass->getShader(), osd_pass_vao[i], osd_pass_vbuffer[i], - icon_texid[major][minor]->textureId(), - ((osd_led_status & bit) != 0) ? color_on : color_off, - false, false, QVector3D(0.0, 0.0, 0.0)); + if(icon_texid[major][minor] != NULL) { + drawMain(osd_pass->getShader(), osd_pass_vao[i], osd_pass_vbuffer[i], + icon_texid[major][minor]->textureId(), + ((osd_led_status & bit) != 0) ? color_on : color_off, + false, false, QVector3D(0.0, 0.0, 0.0)); + } } bit <<= 1; } diff --git a/source/src/qt/gui/gl4_5/qt_glutil_gl4_5.cpp b/source/src/qt/gui/gl4_5/qt_glutil_gl4_5.cpp index 3fe930dd2..7e83d3ba5 100644 --- a/source/src/qt/gui/gl4_5/qt_glutil_gl4_5.cpp +++ b/source/src/qt/gui/gl4_5/qt_glutil_gl4_5.cpp @@ -1332,15 +1332,26 @@ void GLDraw_4_5::drawOsdIcons() } else if((i >= 14) && (i < 16)) { // CMT(W) major = 5; minor = i - 14; + } else if((i >= 16) && (i < 24)) { // HDD + major = 8; + minor = i - 16; + } else if((i >= 24) && (i < 26)) { // CD + major = 6; + minor = i - 24; + } else if((i >= 26) && (i < 28)) { // LD + major = 7; + minor = i - 26; } else { major = 0; minor = 0; } if(major != 0) { - drawMain(osd_pass->getShader(), osd_pass_vao[i], osd_pass_vbuffer[i], - icon_texid[major][minor]->textureId(), - ((osd_led_status & bit) != 0) ? color_on : color_off, - false, false, QVector3D(0.0, 0.0, 0.0)); + if(icon_texid[major][minor] != NULL) { + drawMain(osd_pass->getShader(), osd_pass_vao[i], osd_pass_vbuffer[i], + icon_texid[major][minor]->textureId(), + ((osd_led_status & bit) != 0) ? color_on : color_off, + false, false, QVector3D(0.0, 0.0, 0.0)); + } } bit <<= 1; } @@ -1827,13 +1838,11 @@ void GLDraw_4_5::uploadIconTexture(QPixmap *p, int icon_type, int localnum) if(p == NULL) return; p_wid->makeCurrent(); QImage image = p->toImage(); - if(icon_texid[icon_type][localnum] != NULL) delete icon_texid[icon_type][localnum]; { icon_texid[icon_type][localnum] = new QOpenGLTexture(image); } p_wid->doneCurrent(); - } diff --git a/source/src/qt/gui/gles2/qt_glutil_gles_2.cpp b/source/src/qt/gui/gles2/qt_glutil_gles_2.cpp index f742d9c5b..a2e5b037b 100644 --- a/source/src/qt/gui/gles2/qt_glutil_gles_2.cpp +++ b/source/src/qt/gui/gles2/qt_glutil_gles_2.cpp @@ -1159,15 +1159,26 @@ void GLDraw_ES_2::drawOsdIcons() } else if((i >= 14) && (i < 16)) { // CMT(W) major = 5; minor = i - 14; + } else if((i >= 16) && (i < 24)) { // HDD + major = 8; + minor = i - 16; + } else if((i >= 24) && (i < 26)) { // CD + major = 6; + minor = i - 24; + } else if((i >= 26) && (i < 28)) { // LD + major = 7; + minor = i - 26; } else { major = 0; minor = 0; } if(major != 0) { - drawMain(osd_pass->getShader(), osd_pass_vao[i], osd_pass_vbuffer[i], - icon_texid[major][minor]->textureId(), - ((osd_led_status & bit) != 0) ? color_on : color_off, - false, false, QVector3D(0.0, 0.0, 0.0)); + if(icon_texid[major][minor] != NULL) { + drawMain(osd_pass->getShader(), osd_pass_vao[i], osd_pass_vbuffer[i], + icon_texid[major][minor]->textureId(), + ((osd_led_status & bit) != 0) ? color_on : color_off, + false, false, QVector3D(0.0, 0.0, 0.0)); + } } bit <<= 1; } diff --git a/source/src/qt/gui/menu_flags.h b/source/src/qt/gui/menu_flags.h index 5b56a2b59..570c9a957 100644 --- a/source/src/qt/gui/menu_flags.h +++ b/source/src/qt/gui/menu_flags.h @@ -79,7 +79,8 @@ protected: int base_fd_num; int max_drive; int max_d88_banks; - + uint32_t floppy_type_bit; + int max_draw_ranges; bool use_joystick; @@ -258,6 +259,7 @@ public: int get_max_drive() { return max_drive; } int get_max_d88_banks() { return max_d88_banks; } int get_base_floppy_disk_num() { return base_fd_num; } + uint32_t get_floppy_type_bit() { return floppy_type_bit; } bool is_use_joystick() { return use_joystick; } bool is_use_joy_button_captions() { return use_joy_button_captions; } diff --git a/source/src/qt/gui/menu_flags_tmpl.cpp b/source/src/qt/gui/menu_flags_tmpl.cpp index 000217b7e..9fd7e52dd 100644 --- a/source/src/qt/gui/menu_flags_tmpl.cpp +++ b/source/src/qt/gui/menu_flags_tmpl.cpp @@ -34,7 +34,8 @@ USING_FLAGS::USING_FLAGS(config_t *cfg) use_fd = false; max_drive = max_d88_banks = 0; - + floppy_type_bit = 0x00000000; + max_draw_ranges = 0; use_ram_size = false; max_ram_size = 1; diff --git a/source/src/qt/gui/qt_drawitem.cpp b/source/src/qt/gui/qt_drawitem.cpp index 6da412bc5..38eb09db7 100644 --- a/source/src/qt/gui/qt_drawitem.cpp +++ b/source/src/qt/gui/qt_drawitem.cpp @@ -97,13 +97,23 @@ void CSP_DrawItem::drawFloppy5Inch(QColor &BGColor, QColor &FGColor, QColor &FGC this->fill(BGColor); { double _nwidth = (__width > __height) ? (__height - 2.0) : (__width - 2.0) ; - _nwidth = _nwidth * (0.88 * 0.90); + //_nwidth = _nwidth * (0.88 * 0.90); + _nwidth = _nwidth * 0.88; painter.begin(this); int xbase = (int)((__width - _nwidth) / 2.0); int ybase = (int)((__height - _nwidth) * 0.5); int wbase = (int)_nwidth; int hbase = wbase; - drawRectItem(xbase, ybase, wbase, hbase, fill_brush, FGColor, FGColor); + { + //QPointF points[4] = { + // QPointF((float)xbase, (float)ybase), + // QPointF((float)(xbase + wbase), (float)ybase), + // QPointF((float)(xbase + wbase), (float)(ybase + hbase)), + // QPointF((float)(xbase), (float)(ybase + hbase)) + //}; + //drawPolygonItem(points, 4, fill_brush, FGColor, FGColor); + drawRectItem(xbase, ybase, wbase, hbase, fill_brush, FGColor, FGColor); + } { int r = (int)((_nwidth * 0.35) / 2.0); int x = xbase + wbase / 2 - r; @@ -122,6 +132,13 @@ void CSP_DrawItem::drawFloppy5Inch(QColor &BGColor, QColor &FGColor, QColor &FGC int x = (xbase + wbase / 2) - (int)(w / 2.0); int y = (ybase + wbase / 2) + (int)(_nwidth * 0.45 / 2.0); drawRectItem(x, y, w, h, fill_brush, FGColor2, FGColor2); +// QPointF points[4] = { +// QPointF((float)x, (float)y), +// QPointF((float)(x+ w), (float)y), +// QPointF((float)(x + w), (float)(y + h)), +// QPointF((float)(x), (float)(y + h)) +// }; +// drawPolygonItem(points, 4, fill_brush, FGColor2, FGColor2); } if(!text.isEmpty()) { int x = xbase + (int)(_nwidth * 0.65); diff --git a/source/src/qt/gui/qt_glutil.cpp b/source/src/qt/gui/qt_glutil.cpp index 9b4ea861f..e6a3195f3 100644 --- a/source/src/qt/gui/qt_glutil.cpp +++ b/source/src/qt/gui/qt_glutil.cpp @@ -81,7 +81,8 @@ void GLDrawClass::do_update_icon(int icon_type, int localnum, QString message, Q draw_item->clearCanvas(nullColor); break; case 1: - draw_item->drawFloppy5Inch(bg, fg, fg2, tg, pt, message); + draw_item->drawFloppy5Inch(bg, fg3, fg2, tg, pt, message); + icon_type = 2; // Workaround break; case 2: draw_item->drawFloppy3_5Inch(bg, fg3, fg2, fg, tg, pt, message); @@ -151,13 +152,17 @@ void GLDrawClass::initializeGL(void) } if(using_flags->is_use_fd()) { int drvs = using_flags->get_max_drive(); + uint32_t drvbit = using_flags->get_floppy_type_bit(); QString ts, tmps; for(int i = 0; i < drvs; i++) { tmps = QString::fromUtf8(""); ts.setNum(i); tmps = tmps + ts + QString::fromUtf8(":"); - do_update_icon(1, i, tmps, BG, FG, FG2, FG3, LG, TG, 12.0f); // Dedicate to 3.5/5/8? and startnum. - do_update_icon(2, i, tmps, BG, FG, FG2, FG3, LG, TG2, 12.0f); // Dedicate to 3.5/5/8? and startnum. + if((drvbit & (1 << i)) == 0) { + do_update_icon(1, i, tmps, BG, FG, FG2, FG3, LG, TG2, 12.0f); // Dedicate to 3.5/5/8? and startnum. + } else { + do_update_icon(2, i, tmps, BG, FG, FG2, FG3, LG, TG2, 12.0f); // Dedicate to 3.5/5/8? and startnum. + } } } if(using_flags->is_use_qd()) { @@ -183,8 +188,8 @@ void GLDrawClass::initializeGL(void) tmps = QString::fromUtf8(""); ts.setNum(i + 1); tmps = tmps + ts; - do_update_icon(4, i, tmps, R_BG, C_FG, C_FG2, C_FG3, LG, C_TG, 12.0f); // Dedicate to 3.5/5/8? and startnum. - do_update_icon(5, i, tmps, W_BG, C_FG, C_FG2, C_FG3, LG, C_TG, 12.0f); // Dedicate to 3.5/5/8? and startnum. + do_update_icon(4, i, tmps, R_BG, C_FG, C_FG2, C_FG3, LG, C_TG, 12.0f); + do_update_icon(5, i, tmps, W_BG, C_FG, C_FG2, C_FG3, LG, C_TG, 12.0f); } } } diff --git a/source/src/vm/fm16pi/fm16pi.h b/source/src/vm/fm16pi/fm16pi.h index f9cf3e6ed..fcf5b745f 100644 --- a/source/src/vm/fm16pi/fm16pi.h +++ b/source/src/vm/fm16pi/fm16pi.h @@ -29,6 +29,7 @@ // device informations for win32 #define USE_FLOPPY_DISK 2 +#define USE_FLOPPY_TYPE_BIT 0x0003 /* 3.5, 3.5 */ #define USE_AUTO_KEY 5 #define USE_AUTO_KEY_RELEASE 6 #define USE_NOTIFY_POWER_OFF diff --git a/source/src/vm/fm7/fm7.h b/source/src/vm/fm7/fm7.h index a1170a195..f4c7ca4fd 100644 --- a/source/src/vm/fm7/fm7.h +++ b/source/src/vm/fm7/fm7.h @@ -339,7 +339,11 @@ #define MB8877_NO_BUSY_AFTER_SEEK //#define ENABLE_OPENCL // If OpenCL renderer is enabled, define here. - +#if defined(_FM77_VARIANTS) || defined(_FM77AV_VARIANTS) + #define USE_FLOPPY_TYPE_BIT 0x0003 /* 5.0, 5.0, 3.5, 3.5 */ +#else + #define USE_FLOPPY_TYPE_BIT 0x0000 /* 5.0, 5.0, 5.0, 5.0 */ +#endif //#include "../../config.h" #include "../../common.h" #include "../../fileio.h" diff --git a/source/src/vm/fmr30/fmr30.h b/source/src/vm/fmr30/fmr30.h index cf3c0b100..bb3c0f833 100644 --- a/source/src/vm/fmr30/fmr30.h +++ b/source/src/vm/fmr30/fmr30.h @@ -37,6 +37,7 @@ // device informations for win32 #define USE_FLOPPY_DISK 2 +#define USE_FLOPPY_TYPE_BIT 0x0003 /* 3.5, 3.5 */ #define USE_HARD_DISK 7 #define USE_AUTO_KEY 5 #define USE_AUTO_KEY_RELEASE 6 diff --git a/source/src/vm/fmr50/fmr50.h b/source/src/vm/fmr50/fmr50.h index ae3d762a3..f3d92a405 100644 --- a/source/src/vm/fmr50/fmr50.h +++ b/source/src/vm/fmr50/fmr50.h @@ -83,6 +83,8 @@ // device informations for win32 #define USE_CPU_TYPE 2 #define USE_FLOPPY_DISK 4 +#define USE_FLOPPY_TYPE_BIT 0x0003 /* 3.5, 3.5, 5.0, 5.0 */ + #define USE_HARD_DISK 7 #define USE_AUTO_KEY 5 #define USE_AUTO_KEY_RELEASE 6 diff --git a/source/src/vm/fmtowns/fmtowns.h b/source/src/vm/fmtowns/fmtowns.h index 13a62b601..839c99750 100644 --- a/source/src/vm/fmtowns/fmtowns.h +++ b/source/src/vm/fmtowns/fmtowns.h @@ -273,6 +273,7 @@ #define USE_FLOPPY_DISK 4 // ?? #define USE_CART 2 #define USE_SPECIAL_RESET 12 /* 'CD' 'F0' - 'F3' 'H0' - 'H4' 'ICM' 'DEBUG' */ +#define USE_FLOPPY_TYPE_BIT 0x0003 /* 5.0, 5.0, 3.5, 3.5 */ #define NOTIFY_KEY_DOWN #define USE_ALT_F10_KEY