Previous 199869 Revisions Next

r32803 Saturday 18th October, 2014 at 17:23:45 UTC by Andrew Gardner
MT 05527 [Andrew Gardner]

The Qt debugger now behaves more like the Windows one, with horizontal
scrollbars where the core views expect them.
[src/osd/modules/debugger/qt]debugqtdasmwindow.c debugqtlogwindow.c debugqtmainwindow.c debugqtmainwindow.h debugqtmemorywindow.c debugqtview.c debugqtview.h debugqtwindow.h

trunk/src/osd/modules/debugger/qt/debugqtview.c
r32802r32803
33#include "debugqtview.h"
44
55DebuggerView::DebuggerView(const debug_view_type& type,
6                     running_machine* machine,
7                     QWidget* parent) :
6                     running_machine* machine,
7                     QWidget* parent) :
88   QAbstractScrollArea(parent),
99   m_preferBottom(false),
1010   m_view(NULL),
r32802r32803
4545
4646
4747   // Handle the scroll bars
48   const int horizontalScrollCharDiff = m_view->total_size().x - m_view->visible_size().x;
49   const int horizontalScrollSize = horizontalScrollCharDiff < 0 ? 0 : horizontalScrollCharDiff;
50   horizontalScrollBar()->setRange(0, horizontalScrollSize);
51
52   // If the horizontal scroll bar appears, make sure to adjust the vertical scrollbar accordingly
53   const int verticalScrollAdjust = horizontalScrollSize > 0 ? 1 : 0;
54
4855   const int verticalScrollCharDiff = m_view->total_size().y - m_view->visible_size().y;
49   const int scrollSize = verticalScrollCharDiff < 0 ? 0 : verticalScrollCharDiff;
56   const int verticalScrollSize = verticalScrollCharDiff < 0 ? 0 : verticalScrollCharDiff+verticalScrollAdjust;
5057   bool atEnd = false;
5158   if (verticalScrollBar()->value() == verticalScrollBar()->maximum())
5259   {
5360      atEnd = true;
5461   }
55   verticalScrollBar()->setRange(0, scrollSize);
62   verticalScrollBar()->setRange(0, verticalScrollSize);
5663   if (m_preferBottom && atEnd)
5764   {
58      verticalScrollBar()->setValue(scrollSize);
65      verticalScrollBar()->setValue(verticalScrollSize);
5966   }
6067
6168
r32802r32803
115122            if(textAttr & DCA_DISABLED)
116123            {
117124               fgColor.setRgb((fgColor.red()   + bgColor.red())   >> 1,
118                           (fgColor.green() + bgColor.green()) >> 1,
119                           (fgColor.blue()  + bgColor.blue())  >> 1);
125                           (fgColor.green() + bgColor.green()) >> 1,
126                           (fgColor.blue()  + bgColor.blue())  >> 1);
120127            }
121128            if(textAttr & DCA_COMMENT)
122129            {
r32802r32803
134141         // There is a touchy interplay between font height, drawing difference, visible position, etc
135142         // Fonts don't get drawn "down and to the left" like boxes, so some wiggling is needed.
136143         painter.drawText(x*fontWidth,
137                        (y*fontHeight + (fontHeight*0.80)),
138                        QString(m_view->viewdata()[viewDataOffset].byte));
144                      (y*fontHeight + (fontHeight*0.80)),
145                      QString(m_view->viewdata()[viewDataOffset].byte));
139146         viewDataOffset++;
140147      }
141148   }
r32802r32803
151158
152159
153160   // Handle the scroll bars
161   const int horizontalScrollCharDiff = m_view->total_size().x - m_view->visible_size().x;
162   const int horizontalScrollSize = horizontalScrollCharDiff < 0 ? 0 : horizontalScrollCharDiff;
163   horizontalScrollBar()->setRange(0, horizontalScrollSize);
164
165   // If the horizontal scroll bar appears, make sure to adjust the vertical scrollbar accordingly
166   const int verticalScrollAdjust = horizontalScrollSize > 0 ? 1 : 0;
167
154168   const int verticalScrollCharDiff = m_view->total_size().y - m_view->visible_size().y;
155   const int scrollSize = verticalScrollCharDiff < 0 ? 0 : verticalScrollCharDiff;
169   const int verticalScrollSize = verticalScrollCharDiff < 0 ? 0 : verticalScrollCharDiff+verticalScrollAdjust;
156170   bool atEnd = false;
157171   if (verticalScrollBar()->value() == verticalScrollBar()->maximum())
158172   {
159173      atEnd = true;
160174   }
161   verticalScrollBar()->setRange(0, scrollSize);
175   verticalScrollBar()->setRange(0, verticalScrollSize);
162176   if (m_preferBottom && atEnd)
163177   {
164      verticalScrollBar()->setValue(scrollSize);
178      verticalScrollBar()->setValue(verticalScrollSize);
165179   }
166180
167181
r32802r32803
360374   // Get a handle to the DebuggerView being updated & redraw
361375   DebuggerView* dView = (DebuggerView*)osdPrivate;
362376   dView->verticalScrollBar()->setValue(dView->view()->visible_position().y);
377   dView->horizontalScrollBar()->setValue(dView->view()->visible_position().x);
363378   dView->viewport()->update();
364379   dView->update();
365380}
trunk/src/osd/modules/debugger/qt/debugqtdasmwindow.c
r32802r32803
3838
3939   // The main disasm window
4040   m_dasmView = new DebuggerView(DVT_DISASSEMBLY,
41                           m_machine,
42                           this);
41                          m_machine,
42                          this);
4343
4444   // Force a recompute of the disassembly region
4545   downcast<debug_view_disasm*>(m_dasmView->view())->set_expression("curpc");
r32802r32803
136136         // Find an existing breakpoint at this address
137137         INT32 bpindex = -1;
138138         for (device_debug::breakpoint* bp = cpuinfo->breakpoint_first();
139               bp != NULL;
140               bp = bp->next())
139             bp != NULL;
140             bp = bp->next())
141141         {
142142            if (address == bp->address())
143143            {
trunk/src/osd/modules/debugger/qt/debugqtmainwindow.c
r32802r32803
2727
2828   // The log view
2929   m_consoleView = new DebuggerView(DVT_CONSOLE,
30                              m_machine,
31                              mainWindowFrame);
30                            m_machine,
31                            mainWindowFrame);
3232   m_consoleView->setFocusPolicy(Qt::NoFocus);
3333   m_consoleView->setPreferBottom(true);
3434
r32802r32803
211211         // Find an existing breakpoint at this address
212212         INT32 bpindex = -1;
213213         for (device_debug::breakpoint* bp = cpuinfo->breakpoint_first();
214               bp != NULL;
215               bp = bp->next())
214             bp != NULL;
215             bp = bp->next())
216216         {
217217            if (address == bp->address())
218218            {
r32802r32803
285285      return;
286286   }
287287
288   // If the user asked for help on a specific command, enhance the call
289   if (command.trimmed().startsWith("help", Qt::CaseInsensitive))
290   {
291      if (command.split(" ", QString::SkipEmptyParts).length() == 2)
292      {
293         const int width = m_consoleView->view()->visible_size().x;
294         command.append(QString(", %1").arg(width, 1, 16));
295      }
296   }
297
298288   // Send along the command
299289   debug_console_execute_command(*m_machine,
300                           command.toLocal8Bit().data(),
301                           true);
290                          command.toLocal8Bit().data(),
291                          true);
302292
303293   // Add history & set the index to be the top of the stack
304294   addToHistory(command);
trunk/src/osd/modules/debugger/qt/debugqtwindow.h
r32802r32803
6969      WIN_TYPE_DASM         = 0x04,
7070      WIN_TYPE_LOG          = 0x08,
7171      WIN_TYPE_BREAK_POINTS = 0x10,
72      WIN_TYPE_UNKNOWN      = 0x20,
72      WIN_TYPE_UNKNOWN      = 0x20
7373   };
7474
7575public:
trunk/src/osd/modules/debugger/qt/debugqtview.h
r32802r32803
1212
1313public:
1414   DebuggerView(const debug_view_type& type,
15               running_machine* machine,
16               QWidget* parent=NULL);
15             running_machine* machine,
16             QWidget* parent=NULL);
1717   virtual ~DebuggerView();
1818
1919   void paintEvent(QPaintEvent* event);
trunk/src/osd/modules/debugger/qt/debugqtmemorywindow.c
r32802r32803
234234
235235   m_memoryComboBox->clear();
236236   for (const debug_view_source* source = m_memTable->view()->first_source();
237         source != NULL;
238         source = source->next())
237       source != NULL;
238       source = source->next())
239239   {
240240      m_memoryComboBox->addItem(source->name());
241241   }
r32802r32803
300300         address_space* addressSpace = source->space();
301301         const int nativeDataWidth = addressSpace->data_width() / 8;
302302         const UINT64 memValue = debug_read_memory(*addressSpace,
303                                          addressSpace->address_to_byte(address),
304                                          nativeDataWidth,
305                                          true);
303                                         addressSpace->address_to_byte(address),
304                                         nativeDataWidth,
305                                         true);
306306         const offs_t pc = source->device()->debug()->track_mem_pc_from_space_address_data(addressSpace->spacenum(),
307                                                                        address,
308                                                                        memValue);
307                                                                       address,
308                                                                       memValue);
309309         if (pc != (offs_t)(-1))
310310         {
311311            // TODO: You can specify a box that the tooltip stays alive within - might be good?
trunk/src/osd/modules/debugger/qt/debugqtmainwindow.h
r32802r32803
7878      m_machine(machine)
7979   {
8080      m_dasmView = new DebuggerView(DVT_DISASSEMBLY,
81                              m_machine,
82                              this);
81                             m_machine,
82                             this);
8383
8484      // Force a recompute of the disassembly region
8585      downcast<debug_view_disasm*>(m_dasmView->view())->set_expression("curpc");
r32802r32803
130130      m_machine(machine)
131131   {
132132      m_processorView = new DebuggerView(DVT_STATE,
133                                 m_machine,
134                                 this);
133                                 m_machine,
134                                 this);
135135      m_processorView->setFocusPolicy(Qt::NoFocus);
136136
137137      QVBoxLayout* cvLayout = new QVBoxLayout(this);
trunk/src/osd/modules/debugger/qt/debugqtlogwindow.c
r32802r32803
2525
2626   // The main log view
2727   m_logView = new DebuggerView(DVT_LOG,
28                           m_machine,
29                           this);
28                         m_machine,
29                         this);
3030
3131   // Layout
3232   QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team