/* * Close a user window. Close all if w == 0. */ void closewin(struct ww *w) { char didit = 0; int i; if (w != 0) { closewin1(w); didit++; } else for (i = 0; i < NWINDOW; i++) { if ((w = window[i]) == 0) continue; closewin1(w); didit++; } if (didit) { if (selwin == 0) { if (lastselwin != 0) { setselwin(lastselwin); lastselwin = 0; } else if ((w = findselwin())) setselwin(w); } if (lastselwin == 0 && selwin) if ((w = findselwin())) lastselwin = w; reframe(); } }
BottomPanel::BottomPanel(Widget* parent, const char* n, void (*reframef)(Widget* thisw)) { m_parent = parent; m_type = WIDGET_BOTTOMPANEL; m_name = n; reframefunc = reframef; m_ldown = false; left_outer_toprightcorner = Image(this, "gui/frames/outertopleft64x64.png", true, NULL, 1, 1, 1, 1, 1, 0, 0, 1); left_outer_top = Image(this, "gui/frames/outertop2x64.png", true, NULL, 1, 1, 1, 1, 0, 0, 1, 1); left_minimap = ViewportW(this, "minimap viewport", NULL, &DrawViewport, &ViewportLDown, &ViewportLUp, &ViewportMousemove, &ViewportRDown, &ViewportRUp, ViewportMousewheel, VIEWPORT_MINIMAP); right_outer_topleftcorner = Image(this, "gui/frames/outertopleft64x64.png", true, NULL, 1, 1, 1, 1, 0, 0, 1, 1); right_outer_top = Image(this, "gui/frames/outertop2x64.png", true, NULL, 1, 1, 1, 1, 0, 0, 1, 1); middle_outer_top = Image(this, "gui/frames/outertop2x12.png", true, NULL, 1, 1, 1, 1, 0, 0, 1, 1); white_bg = Image(this, "gui/backg/white.jpg", true, NULL, 1, 1, 1, 1, 0, 0, 1, 1); for(int i=0; i<9; i++) { //bottomright_button[i] = Button(this, "gui/transp.png", RichText(""), MAINFONT8, NULL, NULL, NULL, NULL, i); //bottomright_button[i] = Button(this, "gui/brbut/apartment1.png", RichText(""), MAINFONT8, NULL, NULL, NULL, NULL, i); bottomright_button_on[i] = false; } reframe(); }
void Zprevious_page(void) { int i, col = forcecol(); bpnttomrk(Bbuff, Sstart); for (i = wheight() - prefline() - 2; i > 0 && bcrsearch(Bbuff, NL); --i) i -= bgetcol(true, 0) / Colmax; bmakecol(col); reframe(); }
bool findfile(char *path) { char tbname[BUFNAMMAX + 1]; zbuff_t *tbuff; zbuff_t *was = Curbuff; Arg = 0; /* limit name to BUFNAMMAX */ strncpy(tbname, lastpart(path), BUFNAMMAX); tbname[BUFNAMMAX] = '\0'; /* If is this file already in a buffer - use it. * At startup, we are done. */ foreachbuff(tbuff) if (tbuff->fname && strcmp(path, tbuff->fname) == 0) { zswitchto(tbuff); if (Initializing) return true; set_last_bufname(was); break; } if (!tbuff) { if (cfindbuff(tbname)) { /* Resolve buffer name collisions by creating * a unique name */ char *p; int i; i = strlen(tbname); p = &tbname[i < BUFNAMMAX - 3 ? i : BUFNAMMAX - 3]; /* We cannot use 100 here due to a bug in gcc 7.3.0 */ for (i = 0; i < 99; ++i) { strfmt(p, 4, ".%d", i); if (!cfindbuff(tbname)) break; } if (cfindbuff(tbname)) return false; } if (!readone(tbname, path)) return false; } if (!Initializing) { cswitchto(Curbuff); reframe(); } else if (!*Fname) strcpy(Fname, path); return true; }
/* * Move the window to the top of its group. * Don't do it if already fully visible. * Wwvisible() doesn't work for tinted windows. * But anything to make it faster. * Always reframe() if doreframe is true. */ void front(struct ww *w, char doreframe) { if (w->ww_back != (isfg(w) ? framewin : fgwin) && !wwvisible(w)) { deletewin(w); addwin(w, isfg(w)); doreframe = 1; } if (doreframe) reframe(); }
void Znext_page(void) { int i, col = forcecol(); bpnttomrk(Bbuff, Sstart); for (i = wheight() + prefline() - 2; i > 0 && bcsearch(Bbuff, NL); --i) { bmove(Bbuff, -1); i -= bgetcol(true, 0) / Colmax; bmove1(Bbuff); } bmakecol(col); reframe(); }
void sizewin(struct ww *w, int nrow, int ncol) { struct ww *back = w->ww_back; w->ww_alt.nr = w->ww_w.nr; w->ww_alt.nc = w->ww_w.nc; wwdelete(w); if (wwsize(w, nrow, ncol) < 0) error("Can't resize window: %s.", wwerror()); wwadd(w, back); reframe(); }
TouchListener::TouchListener(Widget* parent, void (*reframef)(Widget* thisw), void (*click2)(int p), void (*overf2)(int p), void (*out)(), int parm) : Widget() { m_parent = parent; m_type = WIDGET_TOUCHLISTENER; m_over = false; m_ldown = false; reframefunc = reframef; clickfunc = NULL; overfunc = NULL; clickfunc2 = click2; overfunc2 = overf2; outfunc = out; m_param = parm; reframe(); }
/* * Open an information (display) window. */ struct ww * openiwin(int nrow, const char *label) { struct ww *w; if ((w = wwopen(WWT_INTERNAL, 0, nrow, wwncol, 2, 0, 0)) == 0) return 0; SET(w->ww_wflags, WWW_MAPNL | WWW_NOINTR | WWW_NOUPDATE | WWW_UNCTRL); SET(w->ww_uflags, WWU_HASFRAME | WWU_CENTER); w->ww_id = -1; (void) setlabel(w, label); addwin(w, 1); reframe(); return w; }
int main() { std::vector<std::string> vec; vec.push_back("This sentence"); vec.push_back("So will this"); vec.push_back("And this"); vec.push_back("This too"); Picture p = vec; Picture q = frame(p); reframe(q, '*', '*', '*'); Picture r = hcat(p, q); Picture s = vcat(q, r); std::cout << r << std::endl; std::cout << "\n\n\n\n\n\n\n\n\n" << std::endl; std::cout << frame(hcat(s, vcat(r, q))) << std::endl; }
ListBox::ListBox(Widget* parent, const char* n, int f, void (*reframef)(Widget* thisw), void (*change)()) : Widget() { m_parent = parent; m_type = WIDGET_LISTBOX; m_name = n; m_font = f; reframefunc = reframef; m_opened = false; m_selected = -1; m_scroll[1] = 0; m_mousescroll = false; m_ldown = false; changefunc = change; CreateTexture(m_frametex, "gui/frame.jpg", true, false); CreateTexture(m_filledtex, "gui/filled.jpg", true, false); CreateTexture(m_uptex, "gui/up.jpg", true, false); //CreateTexture(m_downtex, "gui/down.jpg", true, false); reframe(); }
int Task_Entry::merge_frames (ACE_Unbounded_Set <Dispatch_Entry *> &dispatch_entries, Task_Entry &owner, ACE_Ordered_MultiSet <Dispatch_Entry_Link> &dest, ACE_Ordered_MultiSet <Dispatch_Entry_Link> &src, u_long &dest_period, u_long src_period, u_long number_of_calls, u_long starting_dest_sub_frame) { int status = 0; // reframe dispatches in the destination set to the new frame size // (expands the destination set's period to be the new enclosing frame) if (reframe (dispatch_entries, owner, dest, dest_period, ACE::minimum_frame_size (dest_period, src_period)) < 0) return -1; // use iterator for efficient insertion into the destination set ACE_Ordered_MultiSet_Iterator <Dispatch_Entry_Link> dest_iter (dest); // do virtual iteration over the source set in the new frame, adding // adjusted dispatch entries to the destination Dispatch_Proxy_Iterator src_iter (src, src_period, dest_period, number_of_calls, starting_dest_sub_frame); for (src_iter.first (starting_dest_sub_frame); src_iter.done () == 0; src_iter.advance ()) { // Policy: disjunctively dispatched operations get their // deadline and priority from the original dispatch - when and // if it is useful to change any of the merge policies, this // should be one of the decisions factored out into the // disjunctive merge strategy class. Dispatch_Entry *entry_ptr; ACE_NEW_RETURN (entry_ptr, Dispatch_Entry (src_iter.arrival (), src_iter.deadline (), src_iter.priority (), src_iter.OS_priority (), owner), -1); // if even one new dispatch was inserted, status is "something happened". status = 1; // add the new dispatch entry to the set of all dispatches, and // a link to it to the dispatch links for this task entry if (dispatch_entries.insert (entry_ptr) < 0) return -1; else if (dest.insert (Dispatch_Entry_Link (*entry_ptr), dest_iter) < 0) return -1; // TBD - Clients are not assigned priority, but rather obtain it // from their call dependencies. We could complain here if // there is a priority specified that doesn't match (or is lower // QoS?) } return status; }
int Task_Entry::conjunctive_merge (Dependency_Type dt, ACE_Unbounded_Set <Dispatch_Entry *> &dispatch_entries, ACE_CString &unresolved_locals, ACE_CString &unresolved_remotes) { int result = 0; char string_buffer [BUFSIZ]; // Iterate over the dependencies, and determine the total frame // size. u_long frame_size = 1; ACE_Unbounded_Set_Iterator <Task_Entry_Link *> dep_iter (callers_); for (dep_iter.first (); dep_iter.done () == 0; dep_iter.advance ()) { Task_Entry_Link **link; if (dep_iter.next (link) == 0 || link == 0 || *link == 0) return -1; // The link matches the dependency type given. if ((*link)->dependency_type () == dt) { // Check for and warn about unresolved remote dependencies // in the ONE_WAY call graph. if ((*link)->dependency_type () == RtecBase::ONE_WAY_CALL && (*link)->caller ().has_unresolved_remote_dependencies () && ! this->has_unresolved_remote_dependencies ()) { // Propagate the unresolved remote dependency flag, and // issue a debug scheduler warning. this->has_unresolved_remote_dependencies (1); ORBSVCS_DEBUG ((LM_DEBUG, "Warning: an operation identified by " "\"%s\" has unresolved remote dependencies.\n", (const char*) this->rt_info ()->entry_point)); // Record entry point in list of unresolved remote // dependencies ACE_OS::sprintf (string_buffer, "// %s\n", (const char*) this->rt_info ()->entry_point); unresolved_remotes += ACE_CString (string_buffer); } // Check for and warn about unresolved local dependencies in // the ONE_WAY call graph. if ((*link)->dependency_type () == RtecBase::ONE_WAY_CALL && (*link)->caller ().has_unresolved_local_dependencies () && ! this->has_unresolved_local_dependencies ()) { // Propagate the unresolved local dependency flag, and // issue a debug scheduler warning. this->has_unresolved_local_dependencies (1); ORBSVCS_DEBUG ((LM_DEBUG, "Warning: an operation identified by " "\"%s\" has unresolved local dependencies.\n", (const char*) this->rt_info ()->entry_point)); // Record entry point in list of unresolved local dependencies ACE_OS::sprintf (string_buffer, "// %s\n", (const char*) this->rt_info ()->entry_point); unresolved_locals += ACE_CString (string_buffer); } frame_size = ACE::minimum_frame_size (frame_size, (*link)->caller ().effective_period_); } } // Reframe dispatches in the set to the new frame size (expands the // set's effective period to be the new enclosing frame). if (reframe (dispatch_entries, *this, dispatches_, effective_period_, frame_size) < 0) return -1; // A container and iterator for virtual dispatch sets over which the // conjunction will operate ACE_Ordered_MultiSet <Dispatch_Proxy_Iterator *> conj_set; ACE_Ordered_MultiSet_Iterator <Dispatch_Proxy_Iterator *> conj_set_iter (conj_set); // Iterate over the dependencies, and for each of the given call // type, create a Dispatch_Proxy_Iterator for the caller's dispatch // set, using the caller's period, the total frame size, and the // number of calls: if any of the sets is empty, just return 0; for (dep_iter.first (); dep_iter.done () == 0; dep_iter.advance ()) { Task_Entry_Link **link; if (dep_iter.next (link) == 0 || link == 0 || *link == 0) return -1; // The link matches the dependency type given. if ((*link)->dependency_type () == dt) { Dispatch_Proxy_Iterator *proxy_ptr; ACE_NEW_RETURN (proxy_ptr, Dispatch_Proxy_Iterator ((*link)->caller ().dispatches_, (*link)->caller ().effective_period_, frame_size, (*link)->number_of_calls ()), -1); // If there are no entries in the virtual set, we're done. if (proxy_ptr->done ()) return 0; else if (conj_set.insert (proxy_ptr, conj_set_iter) < 0) return -1; } } // loop, adding conjunctive dispatches, until one of the conjunctive // dispatch sources runs out of entries over the total frame conj_set_iter.first (); int more_dispatches = (conj_set_iter.done ()) ? 0 : 1; while (more_dispatches) { Time arrival = 0; Time deadline = 0; Preemption_Priority priority = 0; OS_Priority OS_priority = 0; for (conj_set_iter.first (); conj_set_iter.done () == 0; conj_set_iter.advance ()) { // initialize to earliest arrival and deadline, and highest priority arrival = 0; deadline = 0; priority = 0; OS_priority = 0; // Policy: conjunctively dispatched operations get the // latest deadline of any of the dispatches in the // conjunction at the time they were dispatched - when and // if it is useful to change any of the merge policies, this // should be one of the decisions factored out into the // conjunctive merge strategy class. // Policy: conjunctively dispatched operations get the // lowest priority of any of the dispatches in the // conjunction at the time they were dispatched - when and // if it is useful to change any of the merge policies, this // should be one of the decisions factored out into the // conjunctive merge strategy class. // Obtain a pointer to the current dispatch proxy iterator. Dispatch_Proxy_Iterator **proxy_iter; if (conj_set_iter.next (proxy_iter) == 0 || proxy_iter == 0 || *proxy_iter == 0) return -1; // Use latest arrival, latest deadline, lowest priority (0 is highest). if (arrival <= (*proxy_iter)->arrival ()) arrival = (*proxy_iter)->arrival (); if (deadline <= (*proxy_iter)->deadline ()) deadline = (*proxy_iter)->deadline (); if (priority <= (*proxy_iter)->priority ()) { priority = (*proxy_iter)->priority (); OS_priority = (*proxy_iter)->OS_priority (); } (*proxy_iter)->advance (); if ((*proxy_iter)->done ()) more_dispatches = 0; } Dispatch_Entry *entry_ptr; ACE_NEW_RETURN (entry_ptr, Dispatch_Entry (arrival, deadline, priority, OS_priority, *this), -1); // If even one new dispatch was inserted, result is "something // happened". result = 1; // Add the new dispatch entry to the set of all dispatches, and // a link to it to the dispatch links for this task entry. if (dispatch_entries.insert (entry_ptr) < 0) return -1; // Use iterator for efficient insertion into the dispatch set. ACE_Ordered_MultiSet_Iterator <Dispatch_Entry_Link> insert_iter (dispatches_); if (dispatches_.insert (Dispatch_Entry_Link (*entry_ptr), insert_iter) < 0) return -1; // TBD - Clients are not assigned priority, but rather obtain it // from their call dependencies. We could complain here if // there is a priority specified that doesn't match (or is lower // QoS?) } return result; }
/* * Close an information window. */ void closeiwin(struct ww *w) { closewin1(w); reframe(); }
/* * Make sure that the display is right. This is a three part process. First, * scan through all of the windows looking for dirty ones. Check the framing, * and refresh the screen. Second, make sure that "currow" and "curcol" are * correct for the current window. Third, make the virtual and physical * screens the same. * * int force; force update past type ahead? */ int update(int force) { struct window *wp; #if TYPEAH && ! PKCODE if (force == FALSE && typahead()) return TRUE; #endif #if VISMAC == 0 if (force == FALSE && kbdmode == PLAY) return TRUE; #endif displaying = TRUE; #if SCROLLCODE /* first, propagate mode line changes to all instances of a buffer displayed in more than one window */ wp = wheadp; while (wp != NULL) { if (wp->w_flag & WFMODE) { if (wp->w_bufp->b_nwnd > 1) { /* make sure all previous windows have this */ struct window *owp; owp = wheadp; while (owp != NULL) { if (owp->w_bufp == wp->w_bufp) owp->w_flag |= WFMODE; owp = owp->w_wndp; } } } wp = wp->w_wndp; } #endif /* update any windows that need refreshing */ wp = wheadp; while (wp != NULL) { if (wp->w_flag) { /* if the window has changed, service it */ reframe(wp); /* check the framing */ #if SCROLLCODE if (wp->w_flag & (WFKILLS | WFINS)) { scrflags |= (wp->w_flag & (WFINS | WFKILLS)); wp->w_flag &= ~(WFKILLS | WFINS); } #endif if ((wp->w_flag & ~WFMODE) == WFEDIT) updone(wp); /* update EDITed line */ else if (wp->w_flag & ~WFMOVE) updall(wp); /* update all lines */ #if SCROLLCODE if (scrflags || (wp->w_flag & WFMODE)) #else if (wp->w_flag & WFMODE) #endif modeline(wp); /* update modeline */ wp->w_flag = 0; wp->w_force = 0; } /* on to the next window */ wp = wp->w_wndp; } /* recalc the current hardware cursor location */ updpos(); #if MEMMAP && ! SCROLLCODE /* update the cursor and flush the buffers */ movecursor(currow, curcol - lbound); #endif /* check for lines to de-extend */ upddex(); /* if screen is garbage, re-plot it */ if (sgarbf != FALSE) updgar(); /* update the virtual screen to the physical screen */ updupd(force); /* update the cursor and flush the buffers */ movecursor(currow, curcol - lbound); TTflush(); displaying = FALSE; #if SIGWINCH while (chg_width || chg_height) newscreensize(chg_height, chg_width); #endif return TRUE; }