OSDN Git Service

[VM] Floppy / CMT : Add Write protection feature, but testing is not enough X-)
authorK.Ohta <whatisthis.sowhat@gmail.com>
Tue, 13 Jan 2015 14:34:32 +0000 (23:34 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Tue, 13 Jan 2015 14:34:32 +0000 (23:34 +0900)
[UI][Qt] Add CMT menu.

17 files changed:
source/src/emu.cpp
source/src/emu.h
source/src/qt/common/emuevents_control.cpp
source/src/qt/common/qt_dialogs.cpp
source/src/qt/common/qt_dialogs.h
source/src/qt/gui/CMakeLists.txt
source/src/qt/gui/commonclasses.h
source/src/qt/gui/menu_cmt.cpp
source/src/qt/gui/menu_disk.cpp
source/src/qt/x1turboz/MainWindow.cpp
source/src/qt/x1turboz/menuclasses.h
source/src/vm/mb8877.h
source/src/vm/pc8801/pc8801.cpp
source/src/vm/pc8801/pc8801.h
source/src/vm/upd765a.h
source/src/vm/x1/x1.cpp
source/src/vm/x1/x1.h

index bd95e46..114a630 100644 (file)
@@ -526,6 +526,20 @@ void EMU::initialize_media()
 #endif\r
 }\r
 \r
+#if defined(USE_FD1) || defined(USE_FD2) || defined(USE_FD3) || defined(USE_FD4) || \\r
+    defined(USE_FD5) || defined(USE_FD6) || defined(USE_FD7) || defined(USE_FD8)\r
+\r
+\r
+void EMU::write_protect_fd(int drv, bool flag)\r
+{\r
+  vm->write_protect_fd(drv, flag);\r
+}\r
+bool EMU::is_write_protected_fd(int drv)\r
+{\r
+  return vm->is_write_protect_fd(drv);\r
+}\r
+#endif\r
+\r
 void EMU::update_media()\r
 {\r
 #ifdef USE_FD1\r
index d74d7f4..977fdb2 100644 (file)
@@ -65,6 +65,9 @@
 #include "common.h"\r
 #include "config.h"\r
 #include "vm/vm.h"\r
+#if defined(USE_FD1)\r
+#include "vm/disk.h"\r
+#endif\r
 \r
 #if defined(_USE_AGAR)\r
 #include "agar_input.h"\r
@@ -750,6 +753,8 @@ public:
        void open_disk(int drv, _TCHAR* file_path, int offset);\r
        void close_disk(int drv);\r
        bool disk_inserted(int drv);\r
+       bool is_write_protected_fd(int drv);\r
+       void write_protect_fd(int drv, bool flag);\r
 #endif\r
 #ifdef USE_QD1\r
        void open_quickdisk(int drv, _TCHAR* file_path);\r
index 99e1558..0274fc7 100644 (file)
@@ -192,58 +192,9 @@ void OnRecentQD(int drive, int menunum)
 }
 #endif
 #ifdef USE_TAPE
-void OnPlayTAPE(QWidget *parent)
-{
-  if(emu) open_tape_dialog(parent, true);
-}
-
-void OnRecTAPE(QWidget *parent)
-{
-  if(emu) open_tape_dialog(parent, false);
-}
-
-void OnCloseTAPE(void)
-{
-  if(emu) emu->close_tape();
-}
-
-void OnUseWaveShaperTAPE(QWidget *wid)
-{
-  config.wave_shaper = !config.wave_shaper;
-  if(wid != NULL) {}
-}
-
-void OnDirectLoadMZT(QWidget *wid)
-{
-  config.direct_load_mzt = !config.direct_load_mzt;
-  if(wid != NULL) {}
-}
 
-void OnRecentTAPE(int menunum)
-{
-  std::string path;
-  int i;
-
-  if((menunum < 0) || (menunum > 7)) return;
-  path = config.recent_tape_path[menunum];
-  for(int i = menunum; i > 0; i--) {
-    strcpy(config.recent_tape_path[i], config.recent_tape_path[i - 1]);
-  }
-  strcpy(config.recent_tape_path[0], path.c_str());
-  if(emu) {
-    emu->play_tape(path.c_str());
-  }
-}
 #endif
 #ifdef USE_TAPE_BUTTON
-void OnPushPlayButton(QWidget *parent)
-{
-  if(emu) emu->push_play();
-}
-void OnPushStopButton(QWidget *parent)
-{
-  if(emu) emu->push_stop();
-}
 #endif
 // Implement LASER-DISC, BINARY
 //
index 1bdf94b..f4eb193 100644 (file)
@@ -26,7 +26,7 @@ void CSP_DiskParams::_open_cart(QString s) {
    emit do_open_cart(d, s);
 }
 void CSP_DiskParams::_open_cmt(QString s) {
-   emit do_open_cmt(s);
+  emit do_open_cmt(play, s);
 }
 
 extern "C" 
index 57a376b..0dbbaa3 100644 (file)
@@ -11,15 +11,15 @@ typedef class CSP_DiskParams : public QObject {
  public:
 //   explicit CSP_DiskParams(QObject *parent = 0);
    CSP_DiskParams(QObject *parent = 0) : QObject(parent){
-       record = false;
+       play = true;
         drive = 0;
    }
    ~CSP_DiskParams() {}
    void setDrive(int num) {if((num < 0) || (num >= 8)) num = 0; drive = num;}
    int getDrive(void) { return drive;}
-   void setRecMode(bool num) {record = num; }
+   void setRecMode(bool num) {play = num; }
    int getRecMode(void) {
-      if(record) return 1;
+      if(play) return 1;
       return 0;;
    }
    
@@ -28,7 +28,7 @@ typedef class CSP_DiskParams : public QObject {
    int do_close_disk(int);
    int do_open_cart(int, QString);
    int do_close_cart(int);
-   int do_open_cmt(QString);
+   int do_open_cmt(bool, QString);
    int do_close_cmt();
    
  public slots:
@@ -37,7 +37,7 @@ typedef class CSP_DiskParams : public QObject {
      void _open_cmt(const QString fname);
  private:
    int drive;
-   bool record;
+   bool play;
 } CSP_FileParams;
 
 typedef class CSP_DiskDialog : public QFileDialog {
@@ -60,9 +60,6 @@ extern void open_cart_dialog(QWidget *hWnd, int drv);
 #endif
 #ifdef USE_FD1
 #endif
-#ifdef USE_TAPE
-extern void open_tape_dialog(QWidget *hWnd, bool play);
-#endif
 }
 
-#endif //End.
\ No newline at end of file
+#endif //End.
index c012228..4f2ba49 100644 (file)
@@ -8,6 +8,7 @@ QT4_WRAP_CPP(s_qt_gui_headers_MOC ${s_qt_gui_headers})
 add_library(qt_gui
          menu_control.cpp
          menu_disk.cpp
+         menu_cmt.cpp
          ${s_qt_gui_headers_MOC}
 )
 
index ce42b88..1bc010c 100644 (file)
@@ -41,6 +41,8 @@ public:
       bindValue = 0;
       drive = 0;
       s_num = 0;
+      play = true; // Read
+      write_protect = false; // Enable to write
    }
    Object_Menu_Control() {}
    // Virtual Functions
@@ -58,24 +60,41 @@ private:
  int bindValue;
  int drive;
  int s_num;
+ bool play;
+ bool write_protect;
 signals:
      int on_boot_mode(int);   
      int on_cpu_type(int);   
      int on_cpu_power(int); 
      int on_open_debugger(int);
+     
      int sig_insert_fd(int);
      int sig_eject_fd(int);
      int set_d88_slot(int, int);
      int set_recent_disk(int, int);
+     int sig_write_protect_fd(int, bool);
+     
+     int sig_insert_play_cmt(bool);
+     int sig_eject_cmt(void);
+     int sig_recent_cmt(int);
+     int sig_set_write_protect_cmt(bool);
 public slots:
      void set_boot_mode(void);
      void set_cputype(void);
      void set_cpupower(void);
      void open_debugger(void);
+     void do_set_write_protect_cmt(void);
+     void do_unset_write_protect_cmt(void);
      void insert_fd(void);
      void eject_fd(void);
      void on_d88_slot(void);
      void on_recent_disk(void);
+     void write_protect_fd(void);
+     void no_write_protect_fd(void);
+     
+     void start_insert_play_cmt(void);
+     void eject_cmt(void);
+     void on_recent_cmt(void);
  public:
    void setValue1(int v) {bindValue = v;}
    int getValue1(void) {return bindValue;}
@@ -83,8 +102,13 @@ public slots:
    int getDrive(void) { return drive;}
    void setNumber(int num) { s_num = num;}
    int getNumber(void) { return s_num;}
-       
-       
+   
+   bool isPlay(void) { return play; }
+   void setPlay(bool b) { play = b; }
+   
+   bool isWriteProtect(void) { return write_protect; }
+   void setWriteProtect(bool b) {write_protect = b;}
+
 } Object_Menu_Control ;
 
 typedef class Action_Control: public QAction {
index fa6c80b..4c4aee7 100644 (file)
 #include "emu_utils.h"
 #include "qt_dialogs.h"
 #include "emu.h"
+#include "agar_logger.h"
 
 QT_BEGIN_NAMESPACE
-void Object_Menu_Control::start_play_cmt_(void) {
-   emit sig_insert_fd(false);
+void Object_Menu_Control::start_insert_play_cmt(void) {
+  printf("%d", play);
+   emit sig_insert_play_cmt(play);
 }
-void Object_Menu_Control::eject_fd(void) {
-   emit sig_eject_fd(drive);
+void Object_Menu_Control::eject_cmt(void) {
+   emit sig_eject_cmt();
 }
-void Object_Menu_Control::on_d88_slot(void) {
-   emit set_d88_slot(drive, s_num);
+void Object_Menu_Control::on_recent_cmt(){
+   emit sig_recent_cmt(s_num);
 }
-void Object_Menu_Control::on_recent_disk(void){
-   emit set_recent_disk(drive, s_num);
+void Object_Menu_Control::do_set_write_protect_cmt(void) {
+   write_protect = true;
+   emit sig_set_write_protect_cmt(write_protect);
 }
+void Object_Menu_Control::do_unset_write_protect_cmt(void) {
+    write_protect = false;
+    emit sig_set_write_protect_cmt(write_protect);
+}
+
 
 // Common Routine
 
-  
-#ifdef USE_FD1
-int Ui_MainWindow::set_d88_slot(int drive, int num)
+#ifdef USE_TAPE  
+void Ui_MainWindow::do_write_protect_cmt(bool flag)
 {
-  if((num < 0) || (num >= MAX_D88_BANKS)) return;
-  if(emu && emu->d88_file[drive].cur_bank != num) {
-    emu->open_disk(drive, emu->d88_file[drive].path, emu->d88_file[drive].bank[num].offset);
-    emu->d88_file[drive].cur_bank = num;
-  }
+   write_protect = flag;
 }
 
-int Ui_MainWindow::set_recent_disk(int drive, int num) 
+
+int Ui_MainWindow::set_recent_cmt(int num) 
  {
     std::string path;
     int i;
     if((num < 0) || (num >= MAX_HISTORY)) return;
     
-    path = config.recent_disk_path[drive][num];
+    path = config.recent_tape_path[num];
     for(int i = num; i > 0; i--) {
-       strcpy(config.recent_disk_path[drive][i], config.recent_disk_path[drive][i - 1]);
+       strcpy(config.recent_tape_path[i], config.recent_tape_path[i - 1]);
     }
-    strcpy(config.recent_disk_path[drive][0], path.c_str());
+    strcpy(config.recent_tape_path[0], path.c_str());
     if(emu) {
-       open_disk(drive, path.c_str(), 0);
+      AGAR_DebugLog(AGAR_LOG_DEBUG, "Tape: Open READ");
+      emu->play_tape(path.c_str()); // Play Readonly, to safety.
     }
     for(i = 0; i < MAX_HISTORY; i++) {
-       if(action_Recent_List_FD[drive][i] != NULL) { 
-         action_Recent_List_FD[drive][i]->setText(config.recent_disk_path[drive][i]);
+       if(action_Recent_List_CMT[i] != NULL) { 
+         action_Recent_List_CMT[i]->setText(config.recent_tape_path[i]);
          //emit action_Recent_List_FD[drive][i]->changed();
        }
     }
@@ -87,10 +92,15 @@ void Ui_MainWindow::open_cmt_dialog(bool play)
   ext = "*.wav;*.cas";
 #endif
   desc1 = play ? "Data Recorder Tape [Play]" : "Data Recorder Tape [Rec]";
+  if(play) {
+    dlg.setWindowTitle("Open Tape");
+  } else {
+    dlg.setWindowTitle("Record Tape");
+  }
   desc2 = desc1 + " (" + ext.toLower() + ")";
   desc1 = desc1 + " (" + ext.toUpper() + ")";
-  if(config.initial_disk_dir != NULL) {
-    dirname = config.initial_disk_dir;         
+  if(config.initial_tape_dir != NULL) {
+    dirname = config.initial_tape_dir;         
   } else {
     char app[PATH_MAX];
     QDir df;
@@ -100,11 +110,10 @@ void Ui_MainWindow::open_cmt_dialog(bool play)
   }
   QStringList filter;
   filter << desc1 << desc2;
-  dlg.param->setDrive(drv);
-  dlg.setDirectory(dirname);
+  dlg.param->setRecMode(play);
   dlg.setNameFilters(filter); 
-  QObject::connect(&dlg, SIGNAL(fileSelected(QString)), this, SLOT(_start_play_cmt(QString))); 
-  QObject::connect(dlg.param, SIGNAL(do_open_disk(bool, QString)), this, SLOT(_open_cmt(bool, QString))); 
+  QObject::connect(&dlg, SIGNAL(fileSelected(QString)), dlg.param, SLOT(_open_cmt(QString))); 
+  QObject::connect(dlg.param, SIGNAL(do_open_cmt(bool, QString)), this, SLOT(_open_cmt(bool, QString))); 
   dlg.show();
   dlg.exec();
   return;
@@ -112,61 +121,38 @@ void Ui_MainWindow::open_cmt_dialog(bool play)
 
 #endif
 
-void Ui_MainWindow::_open_disk(int drv, const QString fname)
+void Ui_MainWindow::set_wave_shaper(bool f)
 {
-   char path_shadow[PATH_MAX];
-   int i;
-
-#ifdef USE_FD1
-   
-   if(fname.length() <= 0) return;
-   strncpy(path_shadow, fname.toUtf8().constData(), PATH_MAX);
-   UPDATE_HISTORY(path_shadow, config.recent_disk_path[drv]);
-//   get_parent_dir(path_shadow);
-   strcpy(config.initial_disk_dir, path_shadow);
-   // Update List
-   open_disk(drv, path_shadow, 0);
-   if((actionGroup_D88_Image_FD[drv] != NULL) && (emu != NULL)){
-      for(i = 0; i < emu->d88_file[drv].bank_num; i++) {
-            if(action_D88_ListImage_FD[drv][i] != NULL) { 
-               action_D88_ListImage_FD[drv][i]->setText(emu->d88_file[drv].bank[i].name);
-               action_D88_ListImage_FD[drv][i]->setVisible(true);
-               //emit action_D88_ListImage_FD[drv][i]->changed();
-            }
-      }
-      for(; i < MAX_D88_BANKS; i++) {
-            if(action_D88_ListImage_FD[drv][i] != NULL) { 
-               //actionSelect_D88_Image_FD[drv][i]->setText(emu->d88_file[drv].bank[i].name);
-               action_D88_ListImage_FD[drv][i]->setVisible(false);
-               //emit action_D88_ListImage_FD[drv][i]->changed();
-            }
-      }
-      actionSelect_D88_Image_FD[drv][0].setChecked(true);
-   }
-   for(i = 0; i < MAX_HISTORY; i++) {
-       if(action_Recent_List_FD[drv][i] != NULL) { 
-         action_Recent_List_FD[drv][i]->setText(QString::fromUtf8(config.recent_disk_path[drv][i]));
-         //actiont_Recent_List_FD[drv][i]->changed();
-       }
-    }
+  config.wave_shaper = f;
+}
+bool Ui_MainWindow::get_wave_shaper(void)
+{
+  if(config.wave_shaper == 0) return false;
+  return true;
+}
 
-#endif
+void Ui_MainWindow::set_direct_load_from_mzt(bool f)
+{
+  config.direct_load_mzt = f;
+}
+bool Ui_MainWindow::get_direct_load_mzt(void)
+{
+  if(config.direct_load_mzt == 0) return false;
+  return true;
 }
 
-void Ui_MainWindow::_open_cart(int drv, const QString fname)
+#ifdef USE_TAPE_BUTTON
+void Ui_MainWindow::OnPushPlayButton(void)
 {
-   char path_shadow[PATH_MAX];
-#ifdef USE_CART1
-   if(fname.length() <= 0) return;
-   strncpy(path_shadow, fname.toUtf8().constData(), PATH_MAX);
-   UPDATE_HISTORY(path_shadow, config.recent_cart_path[drv]);
-   get_parent_dir(path_shadow);
-   strcpy(config.initial_cart_dir, path_shadow);
-
-   if(emu) emu->open_cart(drv, path_shadow);
-#endif
+  if(emu) emu->push_play();
+}
+void Ui_MainWindow::OnPushStopButton(void)
+{
+  if(emu) emu->push_stop();
 }
 
+#endif
+
 void Ui_MainWindow::_open_cmt(bool mode, const QString path)
 {
   char path_shadow[PATH_MAX];
@@ -179,195 +165,171 @@ void Ui_MainWindow::_open_cmt(bool mode, const QString path)
   UPDATE_HISTORY(path_shadow, config.recent_tape_path);
   get_parent_dir(path_shadow);
   strcpy(config.initial_tape_dir, path_shadow);
-   if(play != 0) {
+  // Copy filename again.
+  strncpy(path_shadow, path.toUtf8().constData(), PATH_MAX);
+  if((play != false) || (write_protect != false)) {
+    AGAR_DebugLog(AGAR_LOG_DEBUG, "Tape: Open READ : filename = %s", path_shadow);
       emu->play_tape(path_shadow);
   } else {
-      emu->rec_tape(path_shadow);
+    AGAR_DebugLog(AGAR_LOG_DEBUG, "Tape: Open Write : filename = %s", path_shadow);
+     emu->rec_tape(path_shadow);
   }
 #endif
 }
 
-void Ui_MainWindow::eject_fd(int drv
+void Ui_MainWindow::eject_cmt(void
 {
-   close_disk(drv);
+  if(emu) emu->close_tape();
 }
 
-void Ui_MainWindow::CreateFloppyMenu(Ui_MainWindow *p, int drv, int drv_base)
+void Ui_MainWindow::CreateCMTMenu(Ui_MainWindow *p)
 {
-  QString drv_base_name = QString::number(drv_base); 
-  menuFD[drv] = new QMenu(menubar);
-  menuFD[drv]->setObjectName(QString::fromUtf8("menuFD", -1) + drv_base_name);
-  menuWrite_Protection_FD[drv] = new QMenu(menuFD[drv]);
-  menuWrite_Protection_FD[drv]->setObjectName(QString::fromUtf8("menuWrite_Protection_FD", -1) + drv_base_name);
+  menuCMT = new QMenu(menubar);
+  menuCMT->setObjectName(QString::fromUtf8("menuCMT", -1));
+  menuWrite_Protection_CMT = new QMenu(menuCMT);
+  menuWrite_Protection_CMT->setObjectName(QString::fromUtf8("menuWrite_Protection_CMT", -1));
+  //CreateCMTPulldownMenu(p);
 }
 
-void Ui_MainWindow::CreateFloppyPulldownMenu(Ui_MainWindow *p, int drv)
+void Ui_MainWindow::CreateCMTPulldownMenu(Ui_MainWindow *p)
 {
   
-  menuFD[drv]->addAction(actionInsert_FD[drv]);
-  menuFD[drv]->addAction(actionEject_FD[drv]);
-  menuFD[drv]->addSeparator();
-  menuFD_Recent[drv] = new QMenu(menuFD[drv]);
-  menuFD_Recent[drv]->setObjectName(QString::fromUtf8("Recent_FD", -1) + QString::number(drv));
-  menuFD[drv]->addAction(menuFD_Recent[drv]->menuAction());
-  //        menuFD[drv]->addAction(actionRecent_Opened_FD[0]);
+  menuCMT->addAction(actionInsert_CMT);
+  menuCMT->addAction(actionEject_CMT);
+  menuCMT->addSeparator();
+  menuCMT->addAction(actionPlay_Start);
+  menuCMT->addAction(actionPlay_Stop);
+  
+  menuCMT->addSeparator();
+  menuCMT_Recent = new QMenu(menuCMT);
+  menuCMT_Recent->setObjectName(QString::fromUtf8("Recent_CMT", -1));
+  menuCMT->addAction(menuCMT_Recent->menuAction());
+  //        menuCMT->addAction(actionRecent_Opened_FD[0]);
   {
     int ii;
     for(ii = 0; ii < MAX_HISTORY; ii++) {
-      menuFD_Recent[drv]->addAction(action_Recent_List_FD[drv][ii]);
-      action_Recent_List_FD[drv][ii]->setVisible(true);
+      menuCMT_Recent->addAction(action_Recent_List_CMT[ii]);
+      action_Recent_List_CMT[ii]->setVisible(true);
     }
     
   }
-  menuFD[drv]->addSeparator();
-  menuFD_D88[drv] = new QMenu(menuFD[drv]);
-  menuFD_D88[drv]->setObjectName(QString::fromUtf8("D88_FD", -1) + QString::number(drv));
-  menuFD[drv]->addAction(menuFD_D88[drv]->menuAction());
-  //      menuFD[drv]->addAction(actionSelect_D88_Image_FD[0]);
-  {
-    int ii;
-    for(ii = 0; ii < MAX_D88_BANKS; ii++) {
-      menuFD_D88[drv]->addAction(action_D88_ListImage_FD[drv][ii]);
-      action_D88_ListImage_FD[drv][ii]->setVisible(false);
-    }
-          
-  }
-   
-  menuFD[drv]->addSeparator();
-  //        menuFD[drv]->addAction(menuWrite_Protection_FD1->menuAction());
-  menuWrite_Protection_FD[drv]->addAction(actionProtection_ON_FD[drv]);
-  menuWrite_Protection_FD[drv]->addAction(actionProtection_OFF_FD[drv]);
+  menuCMT->addSeparator();
+  menuCMT->addAction(menuWrite_Protection_CMT->menuAction());
+  menuWrite_Protection_CMT->addAction(actionProtection_ON_CMT);
+  menuWrite_Protection_CMT->addAction(actionProtection_OFF_CMT);
 
 }
 
-void Ui_MainWindow::ConfigFloppyMenuSub(Ui_MainWindow *p, int drv)
+void Ui_MainWindow::ConfigCMTMenuSub(Ui_MainWindow *p)
 {
-  QString drive_name = QString::number(drv);
   
-  actionInsert_FD[drv] = new Action_Control(p);
-  actionInsert_FD[drv]->setObjectName(QString::fromUtf8("actionInsert_FD") + drive_name);
-  actionInsert_FD[drv]->binds->setDrive(0);
-  actionInsert_FD[drv]->binds->setNumber(0);
+  actionInsert_CMT = new Action_Control(p);
+  actionInsert_CMT->setObjectName(QString::fromUtf8("actionInsert_CMT"));
+  actionInsert_CMT->binds->setPlay(true);
+  actionInsert_CMT->binds->setNumber(0);
   
-  actionEject_FD[drv] = new Action_Control(p);
-  actionEject_FD[drv]->setObjectName(QString::fromUtf8("actionEject_FD") + drive_name);
-  actionEject_FD[drv]->binds->setDrive(0);
-  actionEject_FD[drv]->binds->setNumber(0);
+  actionEject_CMT = new Action_Control(p);
+  actionEject_CMT->setObjectName(QString::fromUtf8("actionEject_CMT"));
+  actionEject_CMT->binds->setPlay(true);
+
+  actionPlay_Start = new Action_Control(p);
+  actionPlay_Start->setObjectName(QString::fromUtf8("actionPlay_Start"));
+  actionPlay_Start->binds->setPlay(true);
+
+  actionPlay_Stop = new Action_Control(p);
+  actionPlay_Stop->setObjectName(QString::fromUtf8("actionPlay_Stop"));
+  actionPlay_Stop->binds->setPlay(true);
+
+  actionRecording = new Action_Control(p);
+  actionRecording->setObjectName(QString::fromUtf8("actionRecording"));
+  actionRecording->binds->setPlay(false);
+  actionRecording->binds->setNumber(0);
   
-  actionGroup_Opened_FD[drv] = new QActionGroup(p);
-  actionRecent_Opened_FD[drv] = new Action_Control(p);
-  actionRecent_Opened_FD[drv]->setObjectName(QString::fromUtf8("actionRecent_Opened_FD") + drive_name);
-  actionRecent_Opened_FD[drv]->binds->setDrive(0);
-  actionRecent_Opened_FD[drv]->binds->setNumber(0);
+  actionGroup_Opened_CMT = new QActionGroup(p);
+  actionRecent_Opened_CMT = new Action_Control(p);
+  actionRecent_Opened_CMT->setObjectName(QString::fromUtf8("actionRecent_Opened_CMT"));
+  actionRecent_Opened_CMT->binds->setPlay(true);
   
   {
     int ii;
-    actionGroup_D88_Image_FD[drv] = new QActionGroup(p);
-    actionGroup_D88_Image_FD[drv]->setExclusive(true);
+    actionGroup_Opened_CMT = new QActionGroup(p);
+    actionGroup_Opened_CMT->setExclusive(true);
     
-    actionSelect_D88_Image_FD[drv] = new Action_Control(p);
-    actionSelect_D88_Image_FD[drv]->setObjectName(QString::fromUtf8("actionSelect_D88_Image_FD") + drive_name);
-    actionSelect_D88_Image_FD[drv]->binds->setDrive(0);
-    actionSelect_D88_Image_FD[drv]->binds->setNumber(0);
-    for(ii = 0; ii < MAX_D88_BANKS; ii++) {
-      action_D88_ListImage_FD[drv][ii] = new Action_Control(p);
-      action_D88_ListImage_FD[drv][ii]->binds->setDrive(0);
-      action_D88_ListImage_FD[drv][ii]->binds->setNumber(ii);
-      actionGroup_D88_Image_FD[drv]->addAction(action_D88_ListImage_FD[drv][ii]);
-      connect(action_D88_ListImage_FD[drv][ii], SIGNAL(triggered()),
-             action_D88_ListImage_FD[drv][ii]->binds, SLOT(on_d88_slot()));
-      connect(action_D88_ListImage_FD[drv][ii]->binds, SIGNAL(set_d88_slot(int, int)),
-             this, SLOT(set_d88_slot(int, int)));
+    actionRecent_Opened_CMT = new Action_Control(p);
+    actionRecent_Opened_CMT->setObjectName(QString::fromUtf8("actionSelect_Recent_CMT"));
+    actionRecent_Opened_CMT->binds->setPlay(true); // For safety
+    for(ii = 0; ii < MAX_HISTORY; ii++) {
+      action_Recent_List_CMT[ii] = new Action_Control(p);
+      action_Recent_List_CMT[ii]->binds->setPlay(true);
+      action_Recent_List_CMT[ii]->binds->setNumber(ii);
+      action_Recent_List_CMT[ii]->setText(QString::fromUtf8(config.recent_tape_path[ii]));
+      actionGroup_Opened_CMT->addAction(action_Recent_List_CMT[ii]);
+      connect(action_Recent_List_CMT[ii], SIGNAL(triggered()),
+             action_Recent_List_CMT[ii]->binds, SLOT(on_recent_cmt()));
+      connect(action_Recent_List_CMT[ii]->binds, SIGNAL(sig_recent_cmt(int)),
+             this, SLOT(set_recent_cmt(int)));
     }
   }
+  
   {
     int ii;
-    actionGroup_Opened_FD[drv] = new QActionGroup(p);
-    actionGroup_Opened_FD[drv]->setExclusive(true);
+    actionProtection_ON_CMT = new Action_Control(p);
+    actionProtection_ON_CMT->setObjectName(QString::fromUtf8("actionProtection_ON_CMT"));
+    actionProtection_ON_CMT->setCheckable(true);
+    actionProtection_ON_CMT->setChecked(true);
+    actionProtection_OFF_CMT = new Action_Control(p);
+    actionProtection_OFF_CMT->setObjectName(QString::fromUtf8("actionProtection_OFF_CMT"));
+    actionProtection_OFF_CMT->setCheckable(true);
+    actionProtection_OFF_CMT->setChecked(false);
+    connect(actionProtection_OFF_CMT, SIGNAL(triggered()), actionProtection_OFF_CMT->binds, SLOT(do_unset_write_protect_cmt()));
+    connect(actionProtection_OFF_CMT->binds, SIGNAL(sig_set_write_protect_cmt(bool)), this, SLOT(do_write_protect_cmt(bool)));
+
+    connect(actionProtection_ON_CMT, SIGNAL(triggered()), actionProtection_ON_CMT->binds, SLOT(do_set_write_protect_cmt()));
+    connect(actionProtection_ON_CMT->binds, SIGNAL(sig_set_write_protect_cmt(bool)), this, SLOT(do_write_protect_cmt(bool)));
+
+    actionGroup_Protect_CMT = new QActionGroup(p);
+    //actionGroup_Protect_CMT->setExclusive(true);
+    actionGroup_Protect_CMT->addAction(actionProtection_ON_CMT);
+    actionGroup_Protect_CMT->addAction(actionProtection_OFF_CMT);
+    actionProtection_ON_CMT->setActionGroup(actionGroup_Protect_CMT);
+    actionProtection_OFF_CMT->setActionGroup(actionGroup_Protect_CMT);
     
-    actionRecent_Opened_FD[drv] = new Action_Control(p);
-    actionRecent_Opened_FD[drv]->setObjectName(QString::fromUtf8("actionSelect_Recent_FD") + drive_name);
-    actionRecent_Opened_FD[drv]->binds->setDrive(0);
-    actionRecent_Opened_FD[drv]->binds->setNumber(0);
-    for(ii = 0; ii < MAX_HISTORY; ii++) {
-      action_Recent_List_FD[drv][ii] = new Action_Control(p);
-      action_Recent_List_FD[drv][ii]->binds->setDrive(0);
-      action_Recent_List_FD[drv][ii]->binds->setNumber(ii);
-      action_Recent_List_FD[drv][ii]->setText(QString::fromUtf8(config.recent_disk_path[drv][ii]));
-      actionGroup_Opened_FD[drv]->addAction(action_Recent_List_FD[drv][ii]);
-      connect(action_Recent_List_FD[drv][ii], SIGNAL(triggered()),
-             action_Recent_List_FD[drv][ii]->binds, SLOT(on_recent_disk()));
-      connect(action_Recent_List_FD[drv][ii]->binds, SIGNAL(set_recent_disk(int, int)),
-             this, SLOT(set_recent_disk(int, int)));
-    }
   }
   
-  actionProtection_ON_FD[drv] = new Action_Control(p);
-  actionProtection_ON_FD[drv]->setObjectName(QString::fromUtf8("actionProtection_ON_FD") + drive_name);
-  actionProtection_ON_FD[drv]->setCheckable(true);
-  actionProtection_ON_FD[drv]->setChecked(true);
-  actionProtection_OFF_FD[drv] = new Action_Control(p);
-  actionProtection_OFF_FD[drv]->setObjectName(QString::fromUtf8("actionProtection_OFF_FD1") + drive_name);
-  actionProtection_OFF_FD[drv]->setCheckable(true);
-  
-  connect(actionInsert_FD[drv], SIGNAL(triggered()), actionInsert_FD[drv]->binds, SLOT(insert_fd()));
-  connect(actionInsert_FD[drv]->binds, SIGNAL(sig_insert_fd(int)), this, SLOT(open_disk_dialog(int)));
-  connect(actionEject_FD[drv], SIGNAL(triggered()), actionEject_FD[drv]->binds, SLOT(eject_fd()));
-  connect(actionEject_FD[drv]->binds, SIGNAL(sig_eject_fd(int)), this, SLOT(eject_fd(int)));
+  connect(actionRecording, SIGNAL(triggered()), actionRecording->binds, SLOT(start_insert_play_cmt()));
+  connect(actionRecording->binds, SIGNAL(sig_insert_play_cmt(bool)), this, SLOT(open_cmt_dialog(bool)));
+  connect(actionInsert_CMT, SIGNAL(triggered()), actionInsert_CMT->binds, SLOT(start_insert_play_cmt()));
+  connect(actionInsert_CMT->binds, SIGNAL(sig_insert_play_cmt(bool)), this, SLOT(open_cmt_dialog(bool)));
+  connect(actionEject_CMT, SIGNAL(triggered()), actionEject_CMT->binds, SLOT(eject_cmt()));
   // Translate Menu
 
 
 }
 
-void Ui_MainWindow::retranslateFloppyMenu(Ui_MainWindow *p, int drv, int basedrv)
+void Ui_MainWindow::retranslateCMTMenu(Ui_MainWindow *p)
 {
 
-  QString drive_name = (QApplication::translate("MainWindow", "Floppy ", 0, QApplication::UnicodeUTF8));
-  drive_name += QString::number(basedrv);
-  
-  if((drv < 0) || (drv >= 8)) return;
-  actionInsert_FD[drv]->setText(QApplication::translate("MainWindow", "Insert", 0, QApplication::UnicodeUTF8));
-  actionEject_FD[drv]->setText(QApplication::translate("MainWindow", "Eject", 0, QApplication::UnicodeUTF8));
+  actionInsert_CMT->setText(QApplication::translate("MainWindow", "Insert", 0, QApplication::UnicodeUTF8));
+  actionEject_CMT->setText(QApplication::translate("MainWindow", "Eject", 0, QApplication::UnicodeUTF8));
 
-  menuFD_Recent[drv]->setTitle(QApplication::translate("MainWindow", "Recent Opened", 0, QApplication::UnicodeUTF8));
-  menuFD_D88[drv]->setTitle(QApplication::translate("MainWindow", "Select D88 Image", 0, QApplication::UnicodeUTF8));
+  menuCMT_Recent->setTitle(QApplication::translate("MainWindow", "Recent Opened", 0, QApplication::UnicodeUTF8));
   
-  actionProtection_ON_FD[drv]->setText(QApplication::translate("MainWindow", "Protection ON", 0, QApplication::UnicodeUTF8));
-  actionProtection_OFF_FD[drv]->setText(QApplication::translate("MainWindow", "Protection OFF", 0, QApplication::UnicodeUTF8));
+  actionProtection_ON_CMT->setText(QApplication::translate("MainWindow", "Protection ON", 0, QApplication::UnicodeUTF8));
+  actionProtection_OFF_CMT->setText(QApplication::translate("MainWindow", "Protection OFF", 0, QApplication::UnicodeUTF8));
 
-  menuFD[drv]->setTitle(QApplication::translate("MainWindow", drive_name.toUtf8().constData() , 0, QApplication::UnicodeUTF8));
-  menuWrite_Protection_FD[drv]->setTitle(QApplication::translate("MainWindow", "Write Protection", 0, QApplication::UnicodeUTF8));
+  menuCMT->setTitle(QApplication::translate("MainWindow", "Casette tape" , 0, QApplication::UnicodeUTF8));
+  menuWrite_Protection_CMT->setTitle(QApplication::translate("MainWindow", "Write Protection", 0, QApplication::UnicodeUTF8));
 }
                                                                 
 
 
 
-void Ui_MainWindow::ConfigFloppyMenu(Ui_MainWindow *p)
+void Ui_MainWindow::ConfigCMTMenu(Ui_MainWindow *p)
 {
   
-#if defined(USE_FD1)
-  ConfigFloppyMenuSub(p, 0); 
-#endif
-#if defined(USE_FD2)
-  ConfigFloppyMenuSub(p, 1);
-#endif
-#if defined(USE_FD3)
-  ConfigFloppyMenuSub(p, 2);
-#endif
-#if defined(USE_FD4)
-  ConfigFloppyMenuSub(p, 3);
-#endif
-#if defined(USE_FD5)
-  ConfigFloppyMenuSub(p, 4);
-#endif
-#if defined(USE_FD6)
-  ConfigFloppyMenuSub(p, 5);
-#endif
-#if defined(USE_FD7)
-  ConfigFloppyMenuSub(p, 6);
-#endif
-#if defined(USE_FD8)
-  ConfigFloppyMenuSub(p, 7);
+#if defined(USE_TAPE)
+  write_protect = true;
+  ConfigCMTMenuSub(p); 
 #endif
    
 }
index 9adbb8a..da8a7d2 100644 (file)
@@ -9,27 +9,50 @@
 
 QT_BEGIN_NAMESPACE
 void Object_Menu_Control::insert_fd(void) {
+  //write_protect = false; // Right? On D88, May be writing entry  exists. 
    emit sig_insert_fd(drive);
 }
 void Object_Menu_Control::eject_fd(void) {
+   write_protect = false;
    emit sig_eject_fd(drive);
 }
 void Object_Menu_Control::on_d88_slot(void) {
    emit set_d88_slot(drive, s_num);
 }
 void Object_Menu_Control::on_recent_disk(void){
+  //   write_protect = false; // Right? On D88, May be writing entry  exists. 
    emit set_recent_disk(drive, s_num);
 }
-
+void Object_Menu_Control::write_protect_fd(void) {
+  write_protect = true;
+  emit sig_write_protect_fd(drive, write_protect);
+}
+void Object_Menu_Control::no_write_protect_fd(void) {
+  write_protect = false;
+  emit sig_write_protect_fd(drive, write_protect);
+}
 // Common Routine
-
+int Ui_MainWindow::write_protect_fd(int drv, bool flag)
+{
+  if((drv < 0) || (drv >= MAX_FD)) return;
+  if(emu) {
+    emu->write_protect_fd(drv, flag);
+  }
+}
   
 #ifdef USE_FD1
+
+
 int Ui_MainWindow::set_d88_slot(int drive, int num)
 {
   if((num < 0) || (num >= MAX_D88_BANKS)) return;
   if(emu && emu->d88_file[drive].cur_bank != num) {
     emu->open_disk(drive, emu->d88_file[drive].path, emu->d88_file[drive].bank[num].offset);
+    if(emu->is_write_protected_fd(drive)) {
+       actionProtection_ON_FD[drive]->setChecked(true);
+    } else {
+       actionProtection_OFF_FD[drive]->setChecked(true);
+    }
     emu->d88_file[drive].cur_bank = num;
   }
 }
@@ -47,6 +70,11 @@ int Ui_MainWindow::set_recent_disk(int drive, int num)
     strcpy(config.recent_disk_path[drive][0], path.c_str());
     if(emu) {
        open_disk(drive, path.c_str(), 0);
+       if(emu->is_write_protected_fd(drive)) {
+          actionProtection_ON_FD[drive]->setChecked(true);
+        } else {
+          actionProtection_OFF_FD[drive]->setChecked(true);
+        }
     }
     for(i = 0; i < MAX_HISTORY; i++) {
        if(action_Recent_List_FD[drive][i] != NULL) { 
@@ -64,6 +92,9 @@ void Ui_MainWindow::open_disk_dialog(int drv)
   QString desc2;
   CSP_DiskDialog dlg;
   QString dirname;
+
+  dlg.setWindowTitle("Open Floppy Disk");
+  
   desc2 = desc1 + " (" + ext.toLower() + ")";
   desc1 = desc1 + " (" + ext.toUpper() + ")";
   if(config.initial_disk_dir != NULL) {
@@ -80,7 +111,7 @@ void Ui_MainWindow::open_disk_dialog(int drv)
 
   dlg.param->setDrive(drv);
   dlg.setDirectory(dirname);
-  dlg.setNameFilters(filter); 
+  dlg.setNameFilters(filter);
   QObject::connect(&dlg, SIGNAL(fileSelected(QString)), dlg.param, SLOT(_open_disk(QString))); 
   QObject::connect(dlg.param, SIGNAL(do_open_disk(int, QString)), this, SLOT(_open_disk(int, QString))); 
   dlg.show();
@@ -127,6 +158,11 @@ void Ui_MainWindow::_open_disk(int drv, const QString fname)
          //actiont_Recent_List_FD[drv][i]->changed();
        }
     }
+   if(emu->is_write_protected_fd(drv)) {
+       actionProtection_ON_FD[drv]->setChecked(true);
+    } else {
+       actionProtection_OFF_FD[drv]->setChecked(true);
+    }
 
 #endif
 }
@@ -145,25 +181,6 @@ void Ui_MainWindow::_open_cart(int drv, const QString fname)
 #endif
 }
 
-void Ui_MainWindow::_open_cmt(bool mode, const QString path)
-{
-  char path_shadow[PATH_MAX];
-  int play;
-   
-   play = (mode == false)? 0 : 1;
-#ifdef USE_TAPE
-  if(path.length() <= 0) return;
-  strncpy(path_shadow, path.toUtf8().constData(), PATH_MAX);
-  UPDATE_HISTORY(path_shadow, config.recent_tape_path);
-  get_parent_dir(path_shadow);
-  strcpy(config.initial_tape_dir, path_shadow);
-   if(play != 0) {
-      emu->play_tape(path_shadow);
-  } else {
-      emu->rec_tape(path_shadow);
-  }
-#endif
-}
 
 void Ui_MainWindow::eject_fd(int drv) 
 {
@@ -212,7 +229,7 @@ void Ui_MainWindow::CreateFloppyPulldownMenu(Ui_MainWindow *p, int drv)
   }
    
   menuFD[drv]->addSeparator();
-  //        menuFD[drv]->addAction(menuWrite_Protection_FD1->menuAction());
+  menuFD[drv]->addAction(menuWrite_Protection_FD[drv]->menuAction());
   menuWrite_Protection_FD[drv]->addAction(actionProtection_ON_FD[drv]);
   menuWrite_Protection_FD[drv]->addAction(actionProtection_OFF_FD[drv]);
 
@@ -279,14 +296,31 @@ void Ui_MainWindow::ConfigFloppyMenuSub(Ui_MainWindow *p, int drv)
              this, SLOT(set_recent_disk(int, int)));
     }
   }
-  
-  actionProtection_ON_FD[drv] = new Action_Control(p);
-  actionProtection_ON_FD[drv]->setObjectName(QString::fromUtf8("actionProtection_ON_FD") + drive_name);
-  actionProtection_ON_FD[drv]->setCheckable(true);
-  actionProtection_ON_FD[drv]->setChecked(true);
-  actionProtection_OFF_FD[drv] = new Action_Control(p);
-  actionProtection_OFF_FD[drv]->setObjectName(QString::fromUtf8("actionProtection_OFF_FD1") + drive_name);
-  actionProtection_OFF_FD[drv]->setCheckable(true);
+    {
+    int ii;
+    actionGroup_Protect_FD[drv] = new QActionGroup(p);
+    actionGroup_Protect_FD[drv]->setExclusive(true);
+    actionProtection_ON_FD[drv] = new Action_Control(p);
+    actionProtection_ON_FD[drv]->setObjectName(QString::fromUtf8("actionProtection_ON_FD") + drive_name);
+    actionProtection_ON_FD[drv]->setCheckable(true);
+    actionProtection_ON_FD[drv]->setChecked(true);
+    actionProtection_ON_FD[drv]->binds->setDrive(drv);
+    actionProtection_ON_FD[drv]->binds->setNumber(0);
+    actionProtection_OFF_FD[drv] = new Action_Control(p);
+    actionProtection_OFF_FD[drv]->setObjectName(QString::fromUtf8("actionProtection_OFF_FD") + drive_name);
+    actionProtection_OFF_FD[drv]->setCheckable(true);
+    actionProtection_OFF_FD[drv]->binds->setDrive(drv);
+    actionProtection_OFF_FD[drv]->binds->setNumber(0);
+
+    actionGroup_Protect_FD[drv]->addAction(actionProtection_ON_FD[drv]);
+    actionGroup_Protect_FD[drv]->addAction(actionProtection_OFF_FD[drv]);
+       
+    connect(actionProtection_ON_FD[drv], SIGNAL(triggered()), actionProtection_ON_FD[drv]->binds, SLOT(write_protect_fd()));
+    connect(actionProtection_ON_FD[drv]->binds, SIGNAL(sig_write_protect_fd(int, bool)), this, SLOT(write_protect_fd(int, bool)));
+    connect(actionProtection_OFF_FD[drv], SIGNAL(triggered()), actionProtection_OFF_FD[drv]->binds, SLOT(no_write_protect_fd()));
+    connect(actionProtection_OFF_FD[drv]->binds, SIGNAL(sig_write_protect_fd(int, bool)), this, SLOT(write_protect_fd(int, bool)));
+  }
+
   
   connect(actionInsert_FD[drv], SIGNAL(triggered()), actionInsert_FD[drv]->binds, SLOT(insert_fd()));
   connect(actionInsert_FD[drv]->binds, SIGNAL(sig_insert_fd(int)), this, SLOT(open_disk_dialog(int)));
index 9710020..e5b8d90 100644 (file)
@@ -46,6 +46,7 @@ void Ui_MainWindow::setupUi(void)
    
        ConfigControlMenu(this);
         ConfigFloppyMenu(this);
+        ConfigCMTMenu(this);
        
        
        //actionInsert_QD0 = new QAction(MainWindow);
@@ -59,21 +60,6 @@ void Ui_MainWindow::setupUi(void)
         //actionProtection_OFF_QD0 = new QAction(MainWindow);
         //actionProtection_OFF_QD0->setObjectName(QString::fromUtf8("actionProtection_OFF_QD0"));
        
-        actionInsert_CMT = new Action_Control(this);
-        actionInsert_CMT->setObjectName(QString::fromUtf8("actionInsert_CMT"));
-        actionEject_CMT = new Action_Control(this);
-        actionEject_CMT->setObjectName(QString::fromUtf8("actionEject_CMT"));
-        actionPlay_Start = new Action_Control(this);
-        actionPlay_Start->setObjectName(QString::fromUtf8("actionPlay_Start"));
-        actionPlay_Stop = new Action_Control(this);
-        actionPlay_Stop->setObjectName(QString::fromUtf8("actionPlay_Stop"));
-        actionRecording = new Action_Control(this);
-        actionRecording->setObjectName(QString::fromUtf8("actionRecording"));
-        actionProtection_ON_CMT = new Action_Control(this);
-        actionProtection_ON_CMT->setObjectName(QString::fromUtf8("actionProtection_ON_CMT"));
-        actionProtection_OFF_CMT = new Action_Control(this);
-        actionProtection_OFF_CMT->setObjectName(QString::fromUtf8("actionProtection_OFF_CMT"));
-       
         actionZoom = new Action_Control(this);
         actionZoom->setObjectName(QString::fromUtf8("actionZoom"));
         actionDisplay_Mode = new Action_Control(this);
@@ -189,10 +175,7 @@ void Ui_MainWindow::setupUi(void)
         //menuQD0->setObjectName(QString::fromUtf8("menuQD0"));
         //menuWrite_Protection_QD0 = new QMenu(menuQD0);
         //menuWrite_Protection_QD0->setObjectName(QString::fromUtf8("menuWrite_Protection_QD0"));
-        menuCMT = new QMenu(menubar);
-        menuCMT->setObjectName(QString::fromUtf8("menuCMT"));
-        menuWrite_Protection_CMT = new QMenu(menuCMT);
-        menuWrite_Protection_CMT->setObjectName(QString::fromUtf8("menuWrite_Protection_CMT"));
+       CreateCMTMenu(this);
        
         menuScreen = new QMenu(menubar);
         menuScreen->setObjectName(QString::fromUtf8("menuScreen"));
@@ -235,6 +218,7 @@ void Ui_MainWindow::setupUi(void)
        
        CreateFloppyPulldownMenu(this, 0);
        CreateFloppyPulldownMenu(this, 1);
+        CreateCMTPulldownMenu(this);
        //menuQD0->addAction(actionInsert_QD0);
         //menuQD0->addAction(actionEject_QD0);
         //menuQD0->addSeparator();
@@ -318,7 +302,8 @@ void Ui_MainWindow::setupUi(void)
         QObject::connect(action48000Hz, SIGNAL(triggered()), action48000Hz, SLOT(trigger()));
         QObject::connect(action96000Hz, SIGNAL(triggered()), action96000Hz, SLOT(trigger()));
 
-       QObject::connect(MainWindow, SIGNAL(destroyed()), MainWindow, SLOT(on_actionExit_triggered()));
+       QObject::connect(this, SIGNAL(destroyed()), this, SLOT(on_actionExit_triggered()));
+       QObject::connect(MainWindow, SIGNAL(destroyed()), this, SLOT(on_actionExit_triggered()));
 
         QMetaObject::connectSlotsByName(MainWindow);
 } // setupUi
@@ -333,7 +318,8 @@ void Ui_MainWindow::retranslateUi(Ui_MainWindow *p)
   retranslateControlMenu(p, "NMI Reset",  true);
   retranslateFloppyMenu(p, 0, 0);
   retranslateFloppyMenu(p, 1, 1);
-  
+  retranslateCMTMenu(p);
+   
   p->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8));
 
 
@@ -390,8 +376,6 @@ void Ui_MainWindow::retranslateUi(Ui_MainWindow *p)
        //        menuQD0->setTitle(QApplication::translate("MainWindow", "QD", 0, QApplication::UnicodeUTF8));
         //menuWrite_Protection_QD0->setTitle(QApplication::translate("MainWindow", "Write Protection", 0, QApplication::UnicodeUTF8));
    
-        menuCMT->setTitle(QApplication::translate("MainWindow", "CMT", 0, QApplication::UnicodeUTF8));
-        menuWrite_Protection_CMT->setTitle(QApplication::translate("MainWindow", "Write Protection", 0, QApplication::UnicodeUTF8));
    
         menuScreen->setTitle(QApplication::translate("MainWindow", "Screen", 0, QApplication::UnicodeUTF8));
         menuStretch_Mode->setTitle(QApplication::translate("MainWindow", "Stretch Mode", 0, QApplication::UnicodeUTF8));
index 99f0347..bd09d82 100644 (file)
@@ -64,6 +64,12 @@ class Ui_MainWindow : public QMainWindow
   void CreateFloppyPulldownMenu(Ui_MainWindow *p, int drv);
   void ConfigFloppyMenuSub(Ui_MainWindow *p, int drv);
   void retranslateFloppyMenu(Ui_MainWindow *p, int drv, int basedrv);
+  int write_protect_fd(int drv, bool flag);
+  void CreateCMTMenu(Ui_MainWindow *p);
+  void CreateCMTPulldownMenu(Ui_MainWindow *p);
+  void ConfigCMTMenuSub(Ui_MainWindow *p);
+  void retranslateCMTMenu(Ui_MainWindow *p);
+  void ConfigCMTMenu(Ui_MainWindow *p);
 
   // MainWindow
   QMainWindow *MainWindow;
@@ -96,6 +102,7 @@ class Ui_MainWindow : public QMainWindow
 
 #if defined(USE_CART1) || defined(USE_CART2)
     QActionGroup   *actionGroup_Opened_CART[2];
+    QActionGroup   *actionGroup_Protect_CART[2]; // Is needed?
     class Action_Control *actionRecent_Opened_CART[2];
     class Action_Control *action_Recent_List_CART[2][MAX_HISTORY];
     class Action_Control *actionInsert_CART[2];
@@ -107,6 +114,7 @@ class Ui_MainWindow : public QMainWindow
 #if defined(USE_FD1) || defined(USE_FD2) || defined(USE_FD3) || defined(USE_FD4) || \
   defined(USE_FD5) || defined(USE_FD6) || defined(USE_FD7) || defined(USE_FD8)
     QActionGroup   *actionGroup_Opened_FD[8];
+    QActionGroup   *actionGroup_Protect_FD[8];
     class Action_Control *actionRecent_Opened_FD[8];
     class Action_Control *action_Recent_List_FD[8][MAX_HISTORY];
    
@@ -122,6 +130,7 @@ class Ui_MainWindow : public QMainWindow
 
 #if defined(USE_QD1) || defined(USE_QD2)
     QActionGroup   *actionGroup_Opened_QD[2];
+    QActionGroup   *actionGroup_Protect_QD[2];
     class Action_Control *actionRecent_Opened_QD[2];
     class Action_Control *action_Recent_List_QD[2][MAX_HISTORY];
     class Action_Control *actionInsert_QD[2];
@@ -131,6 +140,7 @@ class Ui_MainWindow : public QMainWindow
 #endif
 #ifdef USE_TAPE    
     QActionGroup   *actionGroup_Opened_CMT;
+    QActionGroup   *actionGroup_Protect_CMT;
     class Action_Control *actionRecent_Opened_CMT;
     class Action_Control *action_Recent_List_CMT[MAX_HISTORY];
     class Action_Control *actionInsert_CMT;
@@ -140,6 +150,7 @@ class Ui_MainWindow : public QMainWindow
     class Action_Control *actionRecording;
     class Action_Control *actionProtection_ON_CMT;
     class Action_Control *actionProtection_OFF_CMT;
+    bool write_protect;
 #endif    
 #if defined(USE_LASER_DISC)
     class Action_Control *actionInsert_LD;
@@ -150,6 +161,7 @@ class Ui_MainWindow : public QMainWindow
 #endif
 #if defined(USE_BINARY)
     QActionGroup   *actionGroup_Opened_BINARY;
+    QActionGroup   *actionGroup_Protect_BINARY; // Is needed?
     class Action_Control *actionRecent_Opened_BINARY;
     class Action_Control *action_Recent_List_BINARY[MAX_HISTORY];
     class Action_Control *actionInsert_BINARY;
@@ -270,7 +282,6 @@ public:
   bool GetEmuThreadEnabled(void) {
        return bRunEmuThread;
   }
-   
   // Getting important widgets.
   QMainWindow *getWindow(void) { return MainWindow; }
   QMenuBar    *getMenuBar(void) { return menubar;}
@@ -288,12 +299,29 @@ public:
 #ifdef USE_DEBUGGER
      void OnOpenDebugger(int no);
 #endif   
-     // Basic slots
+#ifdef USE_TAPE    
+     bool Ui_MainWindow::get_wave_shaper(void);
+     bool Ui_MainWindow::get_direct_load_mzt(void);
+#endif
+    // Basic slots
  public slots:
      void open_disk_dialog(int drv);
      void _open_disk(int drv, const QString fname);
      void _open_cart(int drv, const QString fname);
      void _open_cmt(bool mode,const QString path);
+     void eject_cmt(void);
+    
+#ifdef USE_TAPE
+     void open_cmt_dialog(bool play);
+     void do_write_protect_cmt(bool flag);
+     int  set_recent_cmt(int num);
+     void set_wave_shaper(bool f);
+     void set_direct_load_from_mzt(bool f);
+#ifdef USE_TAPE_BUTTON
+     void OnPushPlayButton(void);
+     void OnPushStopButton(void);
+#endif
+#endif
      void eject_fd(int drv);
      void on_actionExit_triggered() {
        save_config();
@@ -341,6 +369,7 @@ signals:
    int on_insert_fd(int);
    int on_eject_fd(int);
    int do_open_disk(int, QString);
+   int do_recent_cmt(bool);
 };
 namespace Ui {
     class Ui_MainWindow;
index 2b983e9..c9147fd 100644 (file)
@@ -140,6 +140,14 @@ public:
        void set_drive_rpm(int drv, int rpm);\r
        void set_drive_mfm(int drv, bool mfm);\r
        uint8 fdc_status();\r
+       void write_protect_fd(int drive, bool flag) {\r
+         if((drive >= MAX_DRIVE) || (drive < 0)) return;\r
+         disk[drive]->write_protected = flag;\r
+       }\r
+       bool is_write_protect_fd(int drive) {\r
+         if((drive >= MAX_DRIVE) || (drive < 0)) return true; // Protected\r
+         return disk[drive]->write_protected;\r
+       }\r
 };\r
 \r
 #endif\r
index 01e0b34..839c3a9 100644 (file)
@@ -311,6 +311,14 @@ bool VM::disk_inserted(int drv)
 {\r
        return pc88fdc_sub->disk_inserted(drv);\r
 }\r
+void VM::write_protect_fd(int drv, bool flag)\r
+{\r
+       pc88fdc_sub->write_protect_fd(drv, flag);\r
+}\r
+bool VM::is_write_protect_fd(int drv)\r
+{\r
+        return pc88fdc_sub->is_write_protect_fd(drv);\r
+}\r
 \r
 void VM::play_tape(_TCHAR* file_path)\r
 {\r
index 81f3b8c..a14482a 100644 (file)
@@ -177,6 +177,8 @@ public:
        void open_disk(int drv, _TCHAR* file_path, int offset);\r
        void close_disk(int drv);\r
        bool disk_inserted(int drv);\r
+       void write_protect_fd(int drv, bool flag);\r
+       bool is_write_protect_fd(int drv);\r
        void play_tape(_TCHAR* file_path);\r
        void rec_tape(_TCHAR* file_path);\r
        void close_tape();\r
index da4ab72..e522441 100644 (file)
@@ -187,6 +187,14 @@ public:
        void set_drive_rpm(int drv, int rpm);\r
        void set_drive_mfm(int drv, bool mfm);\r
        bool raise_irq_when_media_changed;\r
+       void write_protect_fd(int drive, bool flag) {\r
+         if((drive >= 4) || (drive < 0)) return;\r
+         disk[drive]->write_protected = flag;\r
+       }\r
+       bool is_write_protect_fd(int drive) {\r
+         if((drive >= 4) || (drive < 0)) return true; // Protected\r
+         return disk[drive]->write_protected;\r
+       }\r
 };\r
 \r
 #endif\r
index c7a6bb9..87ed05e 100644 (file)
@@ -577,6 +577,15 @@ bool VM::disk_inserted(int drv)
 {\r
        return fdc->disk_inserted(drv);\r
 }\r
\r
+void VM::write_protect_fd(int drv, bool flag)\r
+{\r
+       fdc->write_protect_fd(drv, flag);\r
+}\r
+ bool VM::is_write_protect_fd(int drv)\r
+{\r
+        return fdc->is_write_protect_fd(drv);\r
+}\r
 \r
 void VM::play_tape(_TCHAR* file_path)\r
 {\r
index 0c9529f..ad4d2b8 100644 (file)
@@ -237,6 +237,8 @@ public:
        void open_disk(int drv, _TCHAR* file_path, int offset);\r
        void close_disk(int drv);\r
        bool disk_inserted(int drv);\r
+       void write_protect_fd(int drv, bool flag);\r
+       bool is_write_protect_fd(int drv);\r
        void play_tape(_TCHAR* file_path);\r
        void rec_tape(_TCHAR* file_path);\r
        void close_tape();\r