// Too hard - details depend on target too much
//
USBDM_ErrorCode HCS12Unsecure::unsecureHCS12Target(void) {
   unsigned long speed;
   USBDMStatus_t usbdmStatus;

   print("HCS12Unsecure::unsecureHCS12Target()\n");

   USBDM_GetBDMStatus(&usbdmStatus);
   USBDM_GetSpeed(&speed);

   // Confirm speed
   HCS12Unsecure dialogue(false, speed);
   dialogue.Create(NULL);
   int getCancelOK = dialogue.ShowModal();

   if (getCancelOK != wxID_OK)
      return BDM_RC_FAIL;
   USBDM_SetSpeed(speed);
   dialogue.bulkEraseMemory();
   unsigned long bdmscr;
   USBDM_ReadStatusReg(&bdmscr); // for debug = UNSEC should be set
   dialogue.programSecurityLocation();
//   closeLogFile();

   return BDM_RC_OK;
}
示例#2
0
文件: step4.c 项目: jimjag/libdill
int main(int argc, char *argv[]) {

    int port = 5555;
    if(argc > 1)
        port = atoi(argv[1]);

    struct ipaddr addr;
    int rc = ipaddr_local(&addr, NULL, port, 0);
    assert(rc == 0);
    int ls = tcp_listen(&addr, 10);
    if(ls < 0) {
        perror("Can't open listening socket");
        return 1;
    }

    int b = bundle();
    assert(b >= 0);

    int i;
    for(i = 0; i != 3; i++) {
        int s = tcp_accept(ls, NULL, -1);
        assert(s >= 0);
        s = suffix_attach(s, "\r\n", 2);
        assert(s >= 0);
        rc = bundle_go(b, dialogue(s));
        assert(rc == 0);
    }

    rc = hclose(b);
    assert(rc == 0);
    rc = hclose(ls);
    assert(rc == 0);

    return 0; 
}
示例#3
0
/**
 * associate all transactions without fyear to the corresponding
 * fyear
 *
 * \param
 *
 * \return FALSE
 * */
gboolean gsb_fyear_config_associate_transactions ( void )
{
    GSList *list_tmp;
    gint modification_number = 0;

    if (!question_yes_no_hint ( _("Automatic association of financial years?"),
				_("This function assigns each transaction without a financial year to the one related to its transaction date.  If no financial year matches, the transaction will not be changed."),
				GTK_RESPONSE_NO ))
	return FALSE;

    list_tmp = gsb_data_transaction_get_complete_transactions_list ();

    while ( list_tmp )
    {
	gint transaction_number;

	transaction_number = gsb_data_transaction_get_transaction_number (list_tmp -> data);

	if (!gsb_data_transaction_get_financial_year_number (transaction_number))
	{
	    gint fyear_number;

	    fyear_number = gsb_data_fyear_get_from_date (gsb_data_transaction_get_date (transaction_number));
	    if (fyear_number)
	    {
		gsb_data_transaction_set_financial_year_number ( transaction_number,
								 fyear_number );
		modification_number++;
	    }
	}
	list_tmp = list_tmp -> next;
    }

    if (modification_number)
    {
	gchar* tmpstr = g_strdup_printf (_("%d transactions associated"),
				    modification_number);
	dialogue (  tmpstr );
	g_free ( tmpstr );
	transaction_list_update_element (ELEMENT_EXERCICE);
        gsb_file_set_modified ( TRUE );
    }
    else
	dialogue ( _("no transaction to associate"));
    return FALSE;
}
示例#4
0
文件: step6.c 项目: jimjag/libdill
int main(int argc, char *argv[]) {

    int port = 5555;
    if(argc > 1)
        port = atoi(argv[1]);

    struct ipaddr addr;
    int rc = ipaddr_local(&addr, NULL, port, 0);
    assert(rc == 0);
    int ls = tcp_listen(&addr, 10);
    if(ls < 0) {
        perror("Can't open listening socket");
        return 1;
    }

    int ch[2];
    rc = chmake(ch);
    assert(rc == 0);
    int cr = go(statistics(ch[0]));
    assert(cr >= 0);

    int b = bundle();
    assert(b >= 0);

    int i;
    for(i = 0; i != 3; i++) {
        int s = tcp_accept(ls, NULL, -1);
        assert(s >= 0);
        s = suffix_attach(s, "\r\n", 2);
        assert(s >= 0);
        rc = bundle_go(b, dialogue(s, ch[1]));
        assert(rc == 0);
    }

    rc = bundle_wait(b, now() + 10000);
    assert(rc == 0 || (rc < 0 && errno == ETIMEDOUT));

    rc = hclose(b);
    assert(rc == 0);
    rc = hclose(cr);
    assert(rc == 0);
    rc = hclose(ch[0]);
    assert(rc == 0);
    rc = hclose(ch[1]);
    assert(rc == 0);
    rc = hclose(ls);
    assert(rc == 0);

    return 0;
}
示例#5
0
void TDMAppearanceWidget::slotLogoButtonClicked()
{
    KImageIO::registerFormats();
    KFileDialog dialogue(locate("data", TQString::fromLatin1("tdm/pics/")),
			 KImageIO::pattern( KImageIO::Reading ),
			 this, 0, true);
    dialogue.setOperationMode( KFileDialog::Opening );
    dialogue.setMode( KFile::File | KFile::LocalOnly );

    KImageFilePreview* imagePreview = new KImageFilePreview( &dialogue );
    dialogue.setPreviewWidget( imagePreview );
    if (dialogue.exec() == TQDialog::Accepted) {
	if ( setLogo(dialogue.selectedFile()) ) {
	    changed();
	}
    }
}
int main(int argc, char *argv[]) {

    int port = 5555;
    if(argc > 1)
        port = atoi(argv[1]);

    ipaddr addr = iplocal(NULL, port, 0);
    tcpsock ls = tcplisten(addr, 10);
    if(!ls) {
        perror("Can't open listening socket");
        return 1;
    }

    while(1) {
        tcpsock as = tcpaccept(ls, -1);
        if(!as)
            continue;
        go(dialogue(as));
    }
}
示例#7
0
文件: export_csv.c 项目: jbq/grisbi
/**
 * try to open the csv file in w mode
 *
 * \param filename
 *
 * \return a FILE pointer or NULL if problem
 * */
static FILE *gsb_csv_export_open_file ( const gchar *filename )
{
    FILE *csv_file;

    /* Création du fichier, si pb, on marque l'erreur et passe au fichier suivant */
    csv_file = utf8_fopen ( filename, "w" );
    if ( ! csv_file )
    {
        gchar *sMessage = NULL;

        sMessage = g_strdup_printf ( _("Unable to create file \"%s\" :\n%s"),
                         filename, g_strerror ( errno ) );
        dialogue ( sMessage );

        g_free ( sMessage );

        return NULL;
    }

    return csv_file;
}
void CollisionTypeDialog::OnIconChange(wxCommandEvent& event)
{
	u8 collisionTypeBits = GetSelection();
	if(collisionTypeBits)
	{
		if(CollisionType* collisionType = m_project.GetCollisionType(collisionTypeBits))
		{
			//Open image file
			wxFileDialog dialogue(this, _("Open Image file"), "", "", "BMP files (*.bmp)|*.bmp", wxFD_OPEN | wxFD_FILE_MUST_EXIST);
			if(dialogue.ShowModal() == wxID_OK)
			{
				wxImage image;
				if(image.LoadFile(dialogue.GetPath()))
				{
					if(image.GetWidth() == sIconWidth && image.GetHeight() == sIconHeight)
					{
						//Set icon data
						const int bytesPerPixel = 3;
						int imageSize = sIconWidth * sIconHeight * bytesPerPixel;
						collisionType->iconData.resize(imageSize);
						unsigned char* imageData = image.GetData();
						ion::memory::MemCopy(&collisionType->iconData[0], imageData, imageSize);

						//Repopulate list and re-select current item to display icons
						PopulateList();
						OnTypeSelected(collisionTypeBits);

						//Refresh collision types panel
						m_mainWindow.RedrawPanel(MainWindow::ePanelCollisionTypes);
					}
					else
					{
						wxMessageBox("Image must be 16x16", "Error", wxOK | wxICON_ERROR);
					}
				}
			}
		}
	}
}
示例#9
0
int main(int argc, char *argv[]) {

    int port = 5555;
    int nproc = 1;
    if(argc > 1)
        port = atoi(argv[1]);
    if(argc > 2)
        nproc = atoi(argv[2]);

    ipaddr addr = iplocal(NULL, port, 0);
    tcpsock ls = tcplisten(addr, 10);
    if(!ls) {
        perror("Can't open listening socket");
        return 1;
    }

    int i;
    for (i = 0; i < nproc - 1; ++i) {
        pid_t pid = fork();
        if(pid < 0) {
           perror("Can't create new process");
           return 1;
        }
        if(pid > 0)
            break;
    }

    chan ch = chmake(int, 0);
    go(statistics(ch));

    while(1) {
        tcpsock as = tcpaccept(ls, -1);
        if(!as)
            continue;
        go(dialogue(as, ch));
    }
}
示例#10
0
/**
 * called by menu : begin the debug mode
 * show a message to say where the log will be saved
 *
 * \param
 *
 * \return FALSE
 * */
gboolean gsb_debug_start_log ( void )
{
    gchar *tmp_str;
    gchar *debug_filename;

    devel_debug ( NULL );

    if ( nom_fichier_comptes )
    {
        gchar *base_filename = g_strdup ( nom_fichier_comptes );
        gchar *complete_filename;
        gchar *basename;

        base_filename [strlen ( base_filename ) - 4] = 0;
        complete_filename = g_strconcat ( base_filename, "-log.txt", NULL);
        basename = g_path_get_basename ( complete_filename );

        debug_filename = g_build_filename ( my_get_gsb_file_default_dir (), basename, NULL);

        g_free ( basename);
        g_free ( complete_filename );
        g_free ( base_filename );
    }
    else
    {
        debug_filename = g_build_filename ( my_get_gsb_file_default_dir (), "No_name-log.txt", NULL);
    }


    tmp_str = g_strdup_printf (_("The debug-mode is starting. Grisbi will write a log into %s. "
                        "Please send that file with the obfuscated file into the bug report."),
                        debug_filename );

    dialogue ( tmp_str );
    g_free (tmp_str);

    debug_file = g_fopen ( debug_filename, "w" );

    g_free ( debug_filename );

    if ( debug_file )
    {
        GtkWidget *widget;
        gchar *tmp_str_2;
        GtkUIManager *ui_manager = gsb_menu_get_ui_manager ( );

        widget = gtk_ui_manager_get_widget ( ui_manager, "/menubar/FileMenu/DebugMode" );
        etat.debug_mode = TRUE;

        /* unsensitive the menu, we cannot reverse the debug mode */
        if ( widget && GTK_IS_WIDGET ( widget ) )
            gtk_widget_set_sensitive ( widget, FALSE );

        /* début du mode débogage */
        tmp_str = g_strdup_printf(_("%s, %2f : Debug - %s:%d:%s\n\n"),
                        get_debug_time ( ),
                        (double ) clock ( )/ CLOCKS_PER_SEC,
                        __FILE__,
                        __LINE__,
                        __PRETTY_FUNCTION__ );
        fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
	    fflush ( debug_file );

        g_free ( tmp_str );

        /* write locales */
        tmp_str = gsb_main_get_print_locale_var ( );

        fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
	    fflush ( debug_file );

        g_free ( tmp_str );

        tmp_str = g_strdup_printf ( "gint64\n"
                        "\tG_GINT64_MODIFIER = \"%s\"\n"
                        "\t%"G_GINT64_MODIFIER"d\n\n",
                        G_GINT64_MODIFIER, G_MAXINT64 );

        fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
	    fflush ( debug_file );

        g_free ( tmp_str );

        tmp_str = gsb_main_get_print_dir_var ( );

        fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
	    fflush ( debug_file );

        g_free ( tmp_str );

        tmp_str = g_strdup ( "Formats importés\n" );
        fwrite ( tmp_str, sizeof (gchar), strlen ( tmp_str ), debug_file );
	    fflush ( debug_file );

        g_free ( tmp_str );

        tmp_str = gsb_import_formats_get_list_formats_to_string ( );
        tmp_str_2 = g_strconcat ( tmp_str, "\n", NULL );

        fwrite ( tmp_str_2, sizeof (gchar), strlen ( tmp_str_2 ), debug_file );
	    fflush ( debug_file );

        g_free ( tmp_str );
        g_free ( tmp_str_2 );
    }
    else
        dialogue_error (_("Grisbi failed to create the log file...") );

    return FALSE;
}
示例#11
0
文件: BdayFrame.cpp 项目: evmcl/bday
void BdayFrame::menuAbout( wxCommandEvent& event )
{
  AboutDialogue dialogue(this);
  dialogue.ShowModal();
}
示例#12
0
/**
 * function called to launch the reconcile_config assistant
 * calculate the number of transactions to link, and refuse to run the assistant if none
 *
 * \param
 *
 * \return GtkResponseType, the returned value from the assistant
 * */
GtkResponseType gsb_assistant_reconcile_config_run ( void )
{
    GtkResponseType return_value;
    GSList *transactions_list = NULL;
    GSList *tmp_list;
    gint transaction_number;
    GtkWidget *assistant;
	gchar* tmpstr;

    tmp_list = gsb_data_transaction_get_transactions_list ();
    while (tmp_list)
    {
	transaction_number = gsb_data_transaction_get_transaction_number (tmp_list -> data);

	if ( gsb_data_transaction_get_marked_transaction (transaction_number) == OPERATION_RAPPROCHEE
	     &&
	     !gsb_data_transaction_get_reconcile_number (transaction_number))
	    transactions_list = g_slist_append ( transactions_list,
						 GINT_TO_POINTER (transaction_number));
	tmp_list = tmp_list -> next;
    }

    if (!transactions_list)
    {
	dialogue (_("No marked transactions without reconciliation found!"));
	return GTK_RESPONSE_CANCEL;
    }

    /* get the number of transactions to associate, we will decrease it for each association */
    transactions_to_link = g_slist_length (transactions_list);

    /* come here if we have some orphan transactions
     * this can happen by 2 ways :
     * for old users of Grisbi, before i don't remember what version, there were no reconcile number,
     * 		the reconciled transactions were juste marked R
     * before the 0.6.0, ctrl R didn't permit to choose a reconciliation
     *
     * for the 2nd item, no problem, we show a list of reconciles and the user can choose what reconcile he wants
     * for the first item the problem is there is no reconcile number to go with that transactions...
     * so we will use the assistant to
     * 	-permit to create a reconcile directly (not possible normaly in the configuration
     * 	-permit to choose a reconcile number for each transactions without reconcile
     * 	- do an automatic find for reconcile, usefull in the first item, when very much
     * 		transactions without reconcile, but we need to make the old reconciles before,
     * 		and set the good date for all the reconciles (because grisbi set them automatically
     * 		at the first update to grisbi 0.6.0 )*/

    /* first, create the assistant */
    tmpstr = g_strdup_printf (_("Grisbi found %d marked transactions not associated with a reconciliation number, "
						       "this can happen for old users of Grisbi or from a misuse of the Ctrl-R shortcut.\n\n"
						       "This assistant will help you make the link between such transactions and a reconciliation.\n\n"
						       "Before continuing, you should first check if all the dates of the existing reconciliations are good "
						       "because Grisbi will try to guess them not very precisely "
						       "(you will be able to create new reconciliations in the next step). "
						       "Previous reconciliations will be available too."),
						       transactions_to_link );
    assistant = gsb_assistant_new ( _("Associate orphan transactions to a reconciliation"),
				    tmpstr,
				    "reconat.png",
				    NULL );
    g_free ( tmpstr );

    gsb_assistant_add_page ( assistant,
			     gsb_assistant_reconcile_config_page_menu (assistant),
			     RECONCILE_ASSISTANT_MENU,
			     RECONCILE_ASSISTANT_INTRO,
			     RECONCILE_ASSISTANT_NEW_RECONCILE,
			     NULL );
    gsb_assistant_add_page ( assistant,
			     gsb_assistant_reconcile_config_page_new_reconcile (),
			     RECONCILE_ASSISTANT_NEW_RECONCILE,
			     RECONCILE_ASSISTANT_MENU,
			     RECONCILE_ASSISTANT_MENU,
			     NULL );
    gsb_assistant_add_page ( assistant,
			     gsb_assistant_reconcile_config_page_automatically_associate (assistant),
			     RECONCILE_ASSISTANT_AUTOMATICALLY_ASSOCIATE,
			     RECONCILE_ASSISTANT_MENU,
			     RECONCILE_ASSISTANT_MENU,
			     G_CALLBACK (gsb_assistant_reconcile_config_update_auto_asso));
    gsb_assistant_add_page ( assistant,
			     gsb_assistant_reconcile_config_page_manually_associate (assistant),
			     RECONCILE_ASSISTANT_MANUALLY_ASSOCIATE,
			     RECONCILE_ASSISTANT_MENU,
			     RECONCILE_ASSISTANT_MENU,
			     G_CALLBACK (gsb_assistant_reconcile_config_update_manu_asso));
    gsb_assistant_add_page ( assistant,
			     gsb_assistant_reconcile_config_page_success (),
			     RECONCILE_ASSISTANT_SUCCESS,
			     RECONCILE_ASSISTANT_MENU,
			     RECONCILE_ASSISTANT_MENU,
			     NULL );
    return_value = gsb_assistant_run (assistant);
    gtk_widget_destroy (assistant);
    return return_value;
}
示例#13
0
文件: qif.c 项目: wazari972/Grisbi
/**
 * export an archive given in param
 * it will create 1 file per account exported, containing
 * 	the transactions of the archive
 * 	the name exported will be "filename-name of the account.qif"
 *
 * \param filename a name without the extension
 * \param archive_number
 *
 * \return TRUE ok, FALSE pb
 * */
gboolean gsb_qif_export_archive ( const gchar *filename,
                        gint archive_number )
{
    GSList *tmp_list;
    GSList *name_list = NULL;
    gint error_return = 0;

    if (!gsb_file_util_test_overwrite (filename))
	return FALSE;

    /* the work (split between accounts) is already done with the archive_store,
     * so just use it */
    tmp_list = gsb_data_archive_store_get_archives_list ();
    while (tmp_list)
    {
	gint archive_store_number;

	archive_store_number = gsb_data_archive_store_get_number (tmp_list -> data);

	if (gsb_data_archive_store_get_archive_number (archive_store_number) == archive_number)
	{
	    gchar *new_filename;

	    new_filename = g_strconcat ( filename,
					 "-",
					 gsb_data_account_get_name (gsb_data_archive_store_get_account_number(archive_store_number)),
					 ".qif",
					 NULL );
	    if (qif_export ( new_filename,
			     gsb_data_archive_store_get_account_number(archive_store_number),
			     archive_number ))
		name_list = g_slist_append ( name_list,
					     new_filename );
	    else
		error_return = 1;
	}
	tmp_list = tmp_list -> next;
    }

    /* if there is more than 1 file created, we show what files we did */
    if (g_slist_length (name_list) > 1)
    {
	gchar *string;

	string = g_strdup_printf ( _("There were many accounts to export in the archive,\nbut the QIF format only support one file per account,\nso Grisbi created %d files, one per account :\n"),
				     g_slist_length (name_list));

	/* add the name to the string */
	tmp_list = name_list;
	while (tmp_list)
	{
	    gchar *new_string;

	    new_string = g_strconcat ( string,
				       "\n",
				       tmp_list -> data,
				       NULL );
	    g_free (string);
	    string = new_string;
	    tmp_list = tmp_list -> next;
	}
	dialogue (string);
	g_free (string);
    }

    /* free the names */
    tmp_list = name_list;
    while (tmp_list)
    {
	g_free (tmp_list -> data);
	tmp_list = tmp_list -> next;
    }
    g_slist_free (name_list);

    return !error_return;
}
示例#14
0
int CALLBACK_start_debug(void *form_control)
{
	CForm *form = (CForm *)form_control;
	CForm *form_debug;
	int nReturn ;
	int t;
	int interval;

	//获取参数
	strcpy(stu_info->debug_time,form->getEditCaption(1));
    strcpy(stu_info->debug_sum,form->getEditCaption(2));
	strcpy(stu_info->debug_interval,form->getEditCaption(3));

	sscanf(stu_info->debug_interval,"%d",&interval);

	if (interval == 0)
	{
		CDialogue dialogue(" 时 间 间 隔 不 能 为 零 ",8,32,8,24);;
		dialogue.show();
		
		return 1;
	}

	if (strlen(stu_info->debug_time) != 0 && strlen(stu_info->debug_sum) != 0 && strlen(stu_info->debug_interval) != 0 )
	{
		//获取选择框选择
		stu_info->isAnswer = form->getOption(1);
		stu_info->use_card= form->getOption(2);
		stu_info->buy_card= form->getOption(3);
		stu_info->phone_last= form->getOption(4);
		stu_info->phone_blur= form->getOption(5);
		stu_info->phone_particular= form->getOption(6);

		if (stu_info->use_card == false && stu_info->buy_card == false && stu_info->phone_last == false && stu_info->phone_blur == false && stu_info->phone_particular == false)
		{
			CDialogue dialogue(" 请 至 少 选 择 一 个 功 能 ",8,32,8,24);;
			dialogue.show();
			
			return 1;
		}


		form_debug  = (CForm *)CALLBACK_form_init(form_control);

		strcpy(time_used,"0");
		strcpy(time_left,stu_info->debug_time);

		//进入测试
		isDebug = 1;
		stu_info->isOK = true;
		
		nReturn = form_debug->show();

		form_debug->unshow();

		return nReturn;

	}
	else
	{
		CDialogue dialogue(" 参 数 不 全 ",8,20,8,30);;
		dialogue.show();
		
		return 1;
	}

	
}
void CollisionTypePanel::OnMouse(wxMouseEvent& event)
{
	if(m_project)
	{
		//Get mouse position in map space
		wxClientDC clientDc(this);
		wxPoint mouseCanvasPosWx = event.GetLogicalPosition(clientDc);
		ion::Vector2 mousePosMapSpace(mouseCanvasPosWx.x, mouseCanvasPosWx.y);

		//Get panel size
		wxSize panelSize = GetClientSize();

		const int maxCollisionTypesPerLayer = 16;

		float x = (m_orientation == eVertical) ? mousePosMapSpace.y : mousePosMapSpace.x;
		float y = (m_orientation == eVertical) ? mousePosMapSpace.x : mousePosMapSpace.y;
		float rectSize = (m_orientation == eVertical) ? (panelSize.y / maxCollisionTypesPerLayer) : (panelSize.x / maxCollisionTypesPerLayer);

		//Get current selection
		unsigned int collisionTypeIndex = (unsigned int)floor(x / rectSize);
		unsigned int collisionLayerId = (unsigned int)floor(y / rectSize);

		//TODO: Multiple layers
		const int numCollisionLayers = 1;

		int iconX = (m_orientation == eVertical) ? collisionTypeIndex : collisionLayerId;
		int iconY = (m_orientation == eVertical) ? collisionLayerId : collisionTypeIndex;
		wxRect rect(iconX * rectSize, iconY * rectSize, rectSize, rectSize);

		u32 collisionBit = 1 << collisionTypeIndex;

		if(collisionLayerId < numCollisionLayers && collisionTypeIndex < maxCollisionTypesPerLayer)
		{
			CollisionType* collisionType = m_project->GetCollisionType(collisionBit);

			if(event.LeftDClick())
			{
				//Create new
				if(!collisionType)
				{
					collisionType = m_project->AddCollisionType(collisionBit);
				}

				//Set default image
				wxImage image(qmark_16_16_xpm);

				//Open image file
				wxFileDialog dialogue(this, _("Open Image file"), "", "", "BMP files (*.bmp)|*.bmp", wxFD_OPEN | wxFD_FILE_MUST_EXIST);
				if(dialogue.ShowModal() == wxID_OK)
				{
					if(image.LoadFile(dialogue.GetPath()))
					{
						if(image.GetWidth() != sIconWidth || image.GetHeight() != sIconHeight)
						{
							wxMessageBox("Image must be 16x16", "Error", wxOK | wxICON_ERROR);
						}
					}
				}

				//Set icon data
				const int bytesPerPixel = 3;
				int imageSize = sIconWidth * sIconHeight * bytesPerPixel;
				collisionType->iconData.resize(imageSize);
				unsigned char* imageData = image.GetData();
				ion::memory::MemCopy(&collisionType->iconData[0], imageData, imageSize);

				//Create bitmap for rendering
				if(m_icons.size() < collisionTypeIndex + 1)
					m_icons.resize(collisionTypeIndex + 1);
				m_icons[collisionTypeIndex] = wxBitmap(image, wxBITMAP_SCREEN_DEPTH);

				//Recreate collision types texture
				m_mainWindow->RefreshCollisionTypes();

				//Invalidate collision types
				m_project->InvalidateCollisionTypes(true);

				//Refresh this panel
				Refresh();

				//Refresh collision tile editor panel
				m_mainWindow->RefreshPanel(MainWindow::ePanelTerrainTileEditor);
			}

			if(collisionTypeIndex < m_project->GetCollisionTypeCount())
			{
				if(CollisionType* collisionType = m_project->GetCollisionType(1 << collisionTypeIndex))
				{
					if(!m_tooltip.get())
					{
						//m_tooltip = new wxTipWindow(this, "Test Tooltip", 100, NULL, &rect);
						//m_tooltip->Show();
					}

					if(event.ButtonIsDown(wxMOUSE_BTN_LEFT))
					{
						//Set current collision type
						m_project->SetPaintCollisionType(collisionType);
					}
				}
			}
		}
	}

	event.Skip();
}