Page 1 of 1

Suggestions for Ascii Viewer

Posted: Thu Oct 29, 2009 4:20 pm
by marfi
Hi Eran, thank you for all the debugger related fixes and improvements which you and your coleagues have did in the past. The GDB's integration in CL is really great. Now I have just two suggestions dealing with Ascii Viewer.

I noticed you have limited an amount of printed text. Is there any option to let the debuger print out complete output to this window? I'm asking because I have to explore really long texts in this view and the text is always truncated after some number (255?) of printed characters. It would be nice to have an option which will allow CL to print whole content here.

Another suggestion related to the Ascii Viewer is to offer abbility to print its content as an XML (it means highlighted and formated/indented by tags). It could be done on option/toggle button/radio button placed on the viewer's toolbar in Debugger panel. I suppose you know this behaviour from MS VS's debugger. It is really usefull to have this feature in case you want to explore content of strings which holds some XML structure. What do you think about this idea?

Best regards
Michal

Re: Suggestions for Ascii Viewer

Posted: Fri Oct 30, 2009 9:53 am
by eranif
marfi wrote:I noticed you have limited an amount of printed text. Is there any option to let the debuger print out complete output to this window? I'm asking because I have to explore really long texts in this view and the text is always truncated after some number (255?) of printed characters. It would be nice to have an option which will allow CL to print whole content here.
Yes, I have limited the amount. Currently it is set to 100 (I did it for performance reasons)
You can change it in the following ways (until I will add an option to the debugger settings):

from the 'Debugger' tab, once the debugger started (and you got the control), you can type:

Code: Select all

set print elements 0
this will remove the limitation

But this is not convinient method since you need to do it for each debugging session. to make it more permenant, add the above command to the 'Startup Commands' in the 'Debugger' tab of your project settings.
marfi wrote:Another suggestion related to the Ascii Viewer is to offer abbility to print its content as an XML (it means highlighted and formated/indented by tags). It could be done on option/toggle button/radio button placed on the viewer's toolbar in Debugger panel. I suppose you know this behaviour from MS VS's debugger. It is really usefull to have this feature in case you want to explore content of strings which holds some XML structure. What do you think about this idea?
Its a nice idea (I would do it using drop down menu with various syntax highlight, similar to the one from the main menu 'View -> View As -> '), but wont the syntax highlight break since it does not starts with valid XML (e.g. variable = {XML-CONTENT})

Eran

Re: Suggestions for Ascii Viewer

Posted: Sun Nov 08, 2009 7:56 am
by hwlixiong
I wrote a very simple ASCII viewer, the idea was came from PN2.0 (Programmer notepad 2.0, http://pnotepad.googlecode.com), maybe it can be helpful.

Code: Select all

const char * const asc[] = 
{
	"001 | x01 | SOH (start of heading)",
	"002 | x02 | STX (start of text)",
	"003 | x03 | ETX (end of text)",
	"004 | x04 | EOT (end of transmission)",
	"005 | x05 | ENQ (enquiry)",
	"006 | x06 | ACK (acknowledge)",
	"007 | x07 | BEL (bell)",
	"008 | x08 | BS (backspace)",
	"009 | x09 | TAB (horizontal tab)",
	"010 | x0a | LF (NL new line/line feed)",
	"011 | x0b | VT (vertical tab)",
	"012 | x0c | FF (form feed, NP new page)",
	"013 | x0d | CR (carriage return)",
	"014 | x0e | SO (shift out)",
	"015 | x0f | SI (shift in)",
	"016 | x10 | DLE (data link escape)",
	"017 | x11 | DC1 (device control 1)",
	"018 | x12 | DC2 (device control 2)",
	"019 | x13 | DC3 (device control 3)",
	"020 | x14 | DC4 (device control 4)",
	"021 | x15 | NAK (negative acknowledge)",
	"022 | x16 | SYN (synchronous idle)",
	"023 | x17 | ETB (end of transmission)",
	"024 | x18 | CAN (cancel)",
	"025 | x19 | EM (end of medium)",
	"026 | x1a | SUB (substitute)",
	"027 | x1b | ESC (escape)",
	"028 | x1c | FS (file separator)",
	"029 | x1d | GS (group separator)",
	"030 | x1e | RS (record separator)",
	"031 | x1f | US (unit separator)",
	"032 | x20 | Space",
	"033 | x21 | !",
	"034 | x22 | \"",
	"035 | x23 | #",
	"036 | x24 | $",
	"037 | x25 | %",
	"038 | x26 | &",
	"039 | x27 | '",
	"040 | x28 | (",
	"041 | x29 | )",
	"042 | x2a | *",
	"043 | x2b | +",
	"044 | x2c | ,",
	"045 | x2d | -",
	"046 | x2e | .",
	"047 | x2f | /",
	"048 | x30 | 0",
	"049 | x31 | 1",
	"050 | x32 | 2",
	"051 | x33 | 3",
	"052 | x34 | 4",
	"053 | x35 | 5",
	"054 | x36 | 6",
	"055 | x37 | 7",
	"056 | x38 | 8",
	"057 | x39 | 9",
	"058 | x3a | :",
	"059 | x3b | ;",
	"060 | x3c | <",
	"061 | x3d | =",
	"062 | x3e | >",
	"063 | x3f | ?",
	"064 | x40 | @",
	"065 | x41 | A",
	"066 | x42 | B",
	"067 | x43 | C",
	"068 | x44 | D",
	"069 | x45 | E",
	"070 | x46 | F",
	"071 | x47 | G",
	"072 | x48 | H",
	"073 | x49 | I",
	"074 | x4a | J",
	"075 | x4b | K",
	"076 | x4c | L",
	"077 | x4d | M",
	"078 | x4e | N",
	"079 | x4f | O",
	"080 | x50 | P",
	"081 | x51 | Q",
	"082 | x52 | R",
	"083 | x53 | S",
	"084 | x54 | T",
	"085 | x55 | U",
	"086 | x56 | V",
	"087 | x57 | W",
	"088 | x58 | X",
	"089 | x59 | Y",
	"090 | x5a | Z",
	"091 | x5b | [",
	"092 | x5c | \\",
	"093 | x5d | ]",
	"094 | x5e | ^",
	"095 | x5f | _",
	"096 | x60 | `",
	"097 | x61 | a",
	"098 | x62 | b",
	"099 | x63 | c",
	"100 | x64 | d",
	"101 | x65 | e",
	"102 | x66 | f",
	"103 | x67 | g",
	"104 | x68 | h",
	"105 | x69 | i",
	"106 | x6a | j",
	"107 | x6b | k",
	"108 | x6c | l",
	"109 | x6d | m",
	"110 | x6e | n",
	"111 | x6f | o",
	"112 | x70 | p",
	"113 | x71 | q",
	"114 | x72 | r",
	"115 | x73 | s",
	"116 | x74 | t",
	"117 | x75 | u",
	"118 | x76 | v",
	"119 | x77 | w",
	"120 | x78 | x",
	"121 | x79 | y",
	"122 | x7a | z",
	"123 | x7b | {",
	"124 | x7c | |",
	"125 | x7d | }",
	"126 | x7e | ~",
	"127 | x7f | (del)"
};

ClipsPane::ClipsPane(wxWindow *parent, wxString caption)
		: wxPanel(parent), m_caption(caption)
{
	wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);

	wxArrayString clips;
	clips.Add(wxT("ASCII Characters"));

	m_clips = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, clips, 0 );
	m_clips->SetSelection(0);
	mainSizer->Add(m_clips, 0, wxEXPAND|wxALL, 1);

	m_list = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SORT ); 
	mainSizer->Add( m_list, 1, wxALL|wxEXPAND, 1 );
	
	m_list->Freeze();
	for (size_t i = 0; i < sizeof(asc) / sizeof(char *); ++i)
	{
		wxString txt = _U(asc[i]);
		m_list->Append(txt);
	}
	m_list->Thaw();

	SetSizer( mainSizer );
	Layout();
}
void WorkspacePane::CreateGUIControls()
{
	wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
	SetSizer(mainSizer);

    // selected configuration:

	mainSizer->Add(new wxStaticText(this, wxID_ANY, wxT("Selected Configuration:")), 0, wxEXPAND| wxTOP|wxLEFT|wxRIGHT, 5);

	wxBoxSizer *hsz = new wxBoxSizer(wxHORIZONTAL);
	mainSizer->Add(hsz, 0, wxEXPAND|wxALL, 5);

	wxArrayString choices;
	m_workspaceConfig = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, choices, wxCB_READONLY|wxALIGN_CENTER_VERTICAL);
	m_workspaceConfig->Enable(false);
	ConnectCombo(m_workspaceConfig, WorkspacePane::OnConfigurationManagerChoice);
	hsz->Add(m_workspaceConfig, 1, wxEXPAND);

	wxButton *btn = new wxButton(this, wxID_ANY, wxT("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
	ConnectButton(btn, WorkspacePane::OnConfigurationManager);
	btn->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(WorkspacePane::OnConfigurationManagerUI), NULL, this);
	hsz->Add(btn, 0, wxALIGN_CENTER_VERTICAL);

	// add static line separator
	wxStaticLine *line = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
	mainSizer->Add(line, 0, wxEXPAND);

    // add notebook for tabs
	long bookStyle = wxVB_LEFT|wxVB_FIXED_WIDTH;
	EditorConfigST::Get()->GetLongValue(wxT("WorkspaceView"), bookStyle);
	m_book = new Notebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, bookStyle);

	// Calculate the widthest tab (the one with the 'Workspcae' label)
	int xx, yy;
	wxFont fnt = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
	wxWindow::GetTextExtent(wxT("Workspace"), &xx, &yy, NULL, NULL, &fnt);
	m_book->SetFixedTabWidth(xx + 20);

    m_book->SetAuiManager(m_mgr, m_caption);
	mainSizer->Add(m_book, 1, wxEXPAND | wxALL, 1);

    // create tabs (possibly detached)
	DetachedPanesInfo dpi;
	EditorConfigST::Get()->ReadObject(wxT("DetachedPanesList"), &dpi);
	wxArrayString detachedPanes = dpi.GetPanes();

	m_workspaceTab = new WorkspaceTab(m_book, wxT("Workspace"));
	ADD_WORKSPACE_PAGE(m_workspaceTab, m_workspaceTab->GetCaption());

	m_explorer = new FileExplorer(m_book, wxT("Explorer"));
	ADD_WORKSPACE_PAGE(m_explorer, m_explorer->GetCaption());

	m_winStack = new WindowStack(m_book, wxID_ANY);
	ADD_WORKSPACE_PAGE(m_winStack, wxT("Outline"));

	m_openWindowsPane = new OpenWindowsPanel(m_book, wxT("Tabs"));
	ADD_WORKSPACE_PAGE(m_openWindowsPane, m_openWindowsPane->GetCaption());

	m_clipsTab = new ClipsPane(m_book, wxT("Clips"));
	ADD_WORKSPACE_PAGE(m_clipsTab, wxT("Clips"));
	if (m_book->GetPageCount() > 0) {
		m_book->SetSelection((size_t)0);
	}

	m_mgr->Update();
}