To install nomacs on Ubuntu, add repository of ppa:nomacs/stable:
$ sudo add-apt-repository ppa:nomacs/stable
Then, enter the commands:
$ sudo apt-get update
$ sudo apt-get install nomacs
void wxTextFileFrame::OnMenuOpenSelected(wxCommandEvent& event)
{
wxTextFile file;
wxString text;
int result;
result = FileDialog1->ShowModal();
if(result==wxID_OK){
SetTitle(FileDialog1->GetPath());
file.Open(FileDialog1->GetPath());
for(size_t i=0; i<file.GetLineCount(); i++){
text << file.GetLine(i) << _T("\r\n");
}
file.Close();
TextCtrl1->SetValue(text);
}
}
#include <wx/textfile.h>
/***************************************************************
* Name: HelloWxMain.h
* Purpose: Defines Application Frame
* Author: Buddy ()
* Created: 2014-08-21
* Copyright: Buddy (linux-buddy.blogspot.com)
* License:
**************************************************************/
#ifndef HELLOWXMAIN_H
#define HELLOWXMAIN_H
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include "HelloWxApp.h"
class HelloWxFrame: public wxFrame
{
public:
HelloWxFrame(wxFrame *frame, const wxString& title);
~HelloWxFrame();
private:
//add for "Hello Button"
static const long idButtonHello;
wxBoxSizer* m_MainBox;
wxButton* m_ButtonHello;
void onClickHello(wxCommandEvent& event);
//end of "Hello Button"
enum
{
idMenuQuit = 1000,
idMenuAbout
};
void OnClose(wxCloseEvent& event);
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
#endif // HELLOWXMAIN_H
/***************************************************************
* Name: HelloWxMain.cpp
* Purpose: Code for Application Frame
* Author: Buddy ()
* Created: 2014-08-21
* Copyright: Buddy (linux-buddy.blogspot.com)
* License:
**************************************************************/
#ifdef WX_PRECOMP
#include "wx_pch.h"
#endif
#ifdef __BORLANDC__
#pragma hdrstop
#endif //__BORLANDC__
#include "HelloWxMain.h"
//helper functions
enum wxbuildinfoformat {
short_f, long_f };
wxString wxbuildinfo(wxbuildinfoformat format)
{
wxString wxbuild(wxVERSION_STRING);
if (format == long_f )
{
#if defined(__WXMSW__)
wxbuild << _T("-Windows");
#elif defined(__WXMAC__)
wxbuild << _T("-Mac");
#elif defined(__UNIX__)
wxbuild << _T("-Linux");
#endif
#if wxUSE_UNICODE
wxbuild << _T("-Unicode build");
#else
wxbuild << _T("-ANSI build");
#endif // wxUSE_UNICODE
}
return wxbuild;
}
const long HelloWxFrame::idButtonHello = ::wxNewId(); //Hello Button
BEGIN_EVENT_TABLE(HelloWxFrame, wxFrame)
EVT_CLOSE(HelloWxFrame::OnClose)
EVT_MENU(idMenuQuit, HelloWxFrame::OnQuit)
EVT_MENU(idMenuAbout, HelloWxFrame::OnAbout)
EVT_BUTTON(idButtonHello, HelloWxFrame::onClickHello) //Hello Button
END_EVENT_TABLE()
HelloWxFrame::HelloWxFrame(wxFrame *frame, const wxString& title)
: wxFrame(frame, -1, title)
{
#if wxUSE_MENUS
// create a menu bar
wxMenuBar* mbar = new wxMenuBar();
wxMenu* fileMenu = new wxMenu(_T(""));
fileMenu->Append(idMenuQuit, _("&Quit\tAlt-F4"), _("Quit the application"));
mbar->Append(fileMenu, _("&File"));
wxMenu* helpMenu = new wxMenu(_T(""));
helpMenu->Append(idMenuAbout, _("&About\tF1"), _("Show info about this application"));
mbar->Append(helpMenu, _("&Help"));
SetMenuBar(mbar);
#endif // wxUSE_MENUS
#if wxUSE_STATUSBAR
// create a status bar with some information about the used wxWidgets version
CreateStatusBar(2);
SetStatusText(_("Hello Code::Blocks user!"),0);
SetStatusText(wxbuildinfo(short_f), 1);
#endif // wxUSE_STATUSBAR
//Hello Button
this->SetSizeHints(wxDefaultSize, wxDefaultSize);
m_MainBox = new wxBoxSizer(wxHORIZONTAL);
m_ButtonHello = new wxButton(
this,
idButtonHello,
_T("Hello...!"),
wxDefaultPosition,
wxDefaultSize,
0);
m_MainBox->Add(m_ButtonHello,
0,
wxALL,
5);
this->SetSizer(m_MainBox);
this->Layout();
}
HelloWxFrame::~HelloWxFrame()
{
}
void HelloWxFrame::OnClose(wxCloseEvent &event)
{
Destroy();
}
void HelloWxFrame::OnQuit(wxCommandEvent &event)
{
Destroy();
}
void HelloWxFrame::OnAbout(wxCommandEvent &event)
{
wxString msg = wxbuildinfo(long_f);
wxMessageBox(msg, _("Welcome to..."));
}
//Hello Button Clicked
void HelloWxFrame::onClickHello(wxCommandEvent &event)
{
wxString msg = _T("Hello World");
wxString info = _T("linux-buddy");
wxMessageBox(msg,
info,
wxOK | wxICON_INFORMATION,
this);
}
/***************************************************************
* Name: HelloWxApp.h
* Purpose: Defines Application Class
* Author: Buddy ()
* Created: 2014-08-21
* Copyright: Buddy (linux-buddy.blogspot.com)
* License:
**************************************************************/
#ifndef HELLOWXAPP_H
#define HELLOWXAPP_H
#include <wx/app.h>
class HelloWxApp : public wxApp
{
public:
virtual bool OnInit();
};
#endif // HELLOWXAPP_H
/***************************************************************
* Name: HelloWxApp.cpp
* Purpose: Code for Application Class
* Author: Buddy ()
* Created: 2014-08-21
* Copyright: Buddy (linux-buddy.blogspot.com)
* License:
**************************************************************/
#ifdef WX_PRECOMP
#include "wx_pch.h"
#endif
#ifdef __BORLANDC__
#pragma hdrstop
#endif //__BORLANDC__
#include "HelloWxApp.h"
#include "HelloWxMain.h"
IMPLEMENT_APP(HelloWxApp);
bool HelloWxApp::OnInit()
{
HelloWxFrame* frame = new HelloWxFrame(0L, _("wxWidgets Application Template"));
frame->Show();
return true;
}
$ sudo apt-get install gcc
$ sudo apt-get install kernel-package
$ sudo apt-get install make
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched.h>
static int __init hello_init(void)
{
printk(KERN_INFO "Hello World! pid = %d\n", current->pid);
return 0;
}
static void __exit hello_exit(void)
{
printk(KERN_INFO "Hello Bye!\n");
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Linux-Buddy: linux-buddy.blogspot.com");
MODULE_DESCRIPTION("Test Module: Hello World");
MODULE_VERSION("1.0");
obj-m += hello.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean