//================================================================ void push_section_to_end(TrackSceneNode* t, int section) { if(!is_section_model(t,section)) return; float dpix, dpiy; get_canvas_dpi( 0, &dpix, &dpiy ); float max_x = 0.0f; CoreSection* max_sec = NULL; for( int i = 0; i < t->modelvec.size(); i++) { if(!is_section_model(t,i)) continue; if( i == section ) continue; CoreSection* cs = get_track_section( t, i); if( cs->px >= max_x ) { max_x = cs->px; max_sec = cs; } } #ifdef DEBUG printf("Max x: %f, Max Sec %d\n", max_x, max_sec); #endif if( max_sec == NULL ) return; CoreSection* sec = get_track_section( t, section ); // do we have image in max_sec? if (max_sec->src != -1) { // we have section image sec->px = max_sec->px + (get_texset_src_width(max_sec->src) * (dpix / max_sec->dpi_x)); } else { // in case that the last one is graph only section // then, use section width instead of texture width sec->px = max_sec->px + max_sec->width * INCH_PER_CM * dpix; } // update section depth var sec->depth = sec->px * CM_PER_INCH / dpix; #ifdef DEBUG printf("Final position for pushing to end %f\n", sec->px); #endif }
//========================================================================== void free_free_draw_rectangle(int fdid) { if(!is_free_draw_rectangle(fdid)) return; TrackSceneNode* tsn; CoreSection* cs; tsn = get_scene_track( freedrawvec[fdid]->track); cs = get_track_section( tsn, freedrawvec[fdid]->section ); if( cs ) detach_free_draw_from_section( cs, fdid ); else if( tsn ) detach_free_draw_from_track( tsn, fdid ); else detach_free_draw_from_scene( fdid ); delete freedrawvec[fdid]; freedrawvec[fdid] = NULL; }
//========================================================================== void render_free_draw(int fdid) { try { #ifdef DEBUG printf("render_free_draw called %%%%%%%%%%%\n"); #endif if( !is_free_draw_rectangle(fdid)) return; if( !is_free_draw_visible(fdid)) return; PluginFreeDrawRectangle *pfdr = freedrawvec[fdid]; #ifdef DEBUG printf("PFDR Data:\nPlugin %d\nX: %f\tY: %f\n", pfdr->plugin, pfdr->x, pfdr->y); printf("W: %f\tH: %f\n", pfdr->w, pfdr->h); #endif JNIEnv* jenv = get_current_jnienv(); if( !jenv ) return; #ifdef DEBUG else printf("JNIEnv Yay\n"); #endif jobject pmo = get_plugin_manager_object(); if( !pmo ) { printf("NULL PMO\n"); return; } #ifdef DEBUG else printf("PMO Yay %d\n", pmo); #endif jclass pmc = get_plugin_manager_class(); if( !pmc ) { return; } #ifdef DEBUG else printf("PMC Yay %d\n", pmc); #endif jmethodID pmm = get_plugin_manager_get_plugin(); if( !pmm ) { return; } #ifdef DEBUG else printf("PMM Yay %d\n", pmm); #endif jobject cpo = jenv->CallObjectMethod( pmo, pmm, pfdr->plugin); if( !cpo ) { return; } #ifdef DEBUG else printf("CPO Yay\n"); #endif jclass cpc = jenv->GetObjectClass(cpo); if( !cpc ) { return; } #ifdef DEBUG else printf("CPC Yay\n"); #endif jmethodID cpm = jenv->GetMethodID( cpc, "renderRectangle", "(IIIIFFFFF)V"); if( !cpm ) { return; } #ifdef DEBUG else printf("CPM Yay\n"); printf("Calling object method!!!\n"); fflush(stdout); #endif int cur_canvas = get_current_canvas(); // if the track id and section id != -1 then set the // width as the the width of the section image scaled for the // canvas CoreSection *cs = get_track_section(get_scene_track(pfdr->track), pfdr->section); jenv->CallObjectMethod( cpo, cpm, fdid, cur_canvas, pfdr->track, pfdr->section, pfdr->x, pfdr->y, pfdr->w, pfdr->h, get_canvas_height(cur_canvas) / get_canvas_orig_height(cur_canvas)); #ifdef DEBUG printf("Called Object Method!!!!\n"); #endif } catch( ... ) { printf("Something very strange!\n"); } }